mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 12:03:16 +02:00
Remove obsolete partition scanner conformance tests
This commit is contained in:
parent
8462736684
commit
d63d948594
1 changed files with 27 additions and 96 deletions
|
@ -29,7 +29,7 @@ import org.eclipse.jface.text.rules.IPartitionTokenScanner;
|
|||
import org.eclipse.jface.text.rules.IToken;
|
||||
|
||||
/**
|
||||
* Compares two <code>IParitionTokenScanner</code>s for conformance and performance.
|
||||
* Compares two <code>IParitionTokenScanner</code>s for performance.
|
||||
*/
|
||||
public class PartitionTokenScannerTest extends TestCase {
|
||||
private static boolean PRINT_TIMING = false;
|
||||
|
@ -82,35 +82,6 @@ public class PartitionTokenScannerTest extends TestCase {
|
|||
return new TestSuite(PartitionTokenScannerTest.class);
|
||||
}
|
||||
|
||||
public void testTestCaseLF() {
|
||||
testConformance(getDocument("TestCase.txt", "\n"));
|
||||
}
|
||||
|
||||
public void testTestCaseCRLF() {
|
||||
testConformance(getDocument("TestCase.txt", "\r\n"));
|
||||
}
|
||||
|
||||
public void testTestCaseCR() {
|
||||
testConformance(getDocument("TestCase.txt", "\r"));
|
||||
}
|
||||
|
||||
public void testTestCase2LF() {
|
||||
testConformance(getDocument("TestCase2.txt", "\n"));
|
||||
}
|
||||
|
||||
public void testTestCase2CRLF() {
|
||||
testConformance(getDocument("TestCase2.txt", "\r\n"));
|
||||
}
|
||||
|
||||
public void testTestCase2CR() {
|
||||
testConformance(getDocument("TestCase2.txt", "\r"));
|
||||
}
|
||||
|
||||
// XXX not fully passing because of "\<LF> and '\<LF>
|
||||
// public void testRandom() {
|
||||
// testConformance(getRandomDocument(2048));
|
||||
// }
|
||||
|
||||
/**
|
||||
* Tests performance of the testee against the reference IPartitionTokenScanner.
|
||||
*/
|
||||
|
@ -142,46 +113,6 @@ public class PartitionTokenScannerTest extends TestCase {
|
|||
return end - start;
|
||||
}
|
||||
|
||||
private void testConformance(final IDocument document) {
|
||||
final StringBuilder message= new StringBuilder();
|
||||
|
||||
fReference.setRange(document, 0, document.getLength());
|
||||
fTestee.setRange(document, 0, document.getLength());
|
||||
|
||||
while (true) {
|
||||
|
||||
message.setLength(0);
|
||||
|
||||
final IToken referenceToken= fReference.nextToken();
|
||||
final IToken testeeToken= fTestee.nextToken();
|
||||
assertTokenEquals(referenceToken, testeeToken);
|
||||
|
||||
final int referenceOffset= fReference.getTokenOffset();
|
||||
final int testeeOffset= fTestee.getTokenOffset();
|
||||
message.append(", offset = " + referenceOffset);
|
||||
message.append(", " + extractString(document, referenceOffset));
|
||||
assertEquals(message.toString(), referenceOffset, testeeOffset);
|
||||
|
||||
int referenceLength= fReference.getTokenLength();
|
||||
final int testeeLength= fTestee.getTokenLength();
|
||||
if(referenceLength != testeeLength) {
|
||||
// Special case where the dum scanner creates a token for every character...
|
||||
IToken t;
|
||||
while(referenceLength < testeeLength) {
|
||||
t = fReference.nextToken();
|
||||
referenceLength += fReference.getTokenLength();
|
||||
if(referenceToken != t)
|
||||
assertEquals(message.toString(), referenceToken, t);
|
||||
}
|
||||
}
|
||||
message.append(", length = " + referenceLength);
|
||||
assertEquals(message.toString(), referenceLength, testeeLength);
|
||||
|
||||
if (referenceToken.isEOF())
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void testPerformance(final IPartitionTokenScanner scanner, final IDocument document) {
|
||||
scanner.setRange(document, 0, document.getLength());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue