use of org.antlr.v4.misc.EscapeSequenceParsing.Result in project antlr4 by antlr.
the class TestIntervalSet method testComplement2.
@Test
public void testComplement2() throws Exception {
IntervalSet s = IntervalSet.of(100, 101);
IntervalSet s2 = IntervalSet.of(100, 102);
String expecting = "102";
String result = (s.complement(s2)).toString();
assertEquals(expecting, result);
}
use of org.antlr.v4.misc.EscapeSequenceParsing.Result in project antlr4 by antlr.
the class TestIntervalSet method testSubtractFromSetWithEOF.
@Test
public void testSubtractFromSetWithEOF() throws Exception {
IntervalSet s = IntervalSet.of(10, 20);
s.add(Token.EOF);
IntervalSet s2 = IntervalSet.of(12, 15);
String expecting = "{<EOF>, 10..11, 16..20}";
String result = (s.subtract(s2)).toString();
assertEquals(expecting, result);
}
use of org.antlr.v4.misc.EscapeSequenceParsing.Result in project antlr4 by antlr.
the class TestIntervalSet method testIntersectionWithTwoContainedElementsReversed.
@Test
public void testIntersectionWithTwoContainedElementsReversed() throws Exception {
IntervalSet s = IntervalSet.of(10, 20);
IntervalSet s2 = IntervalSet.of(2, 2);
s2.add(15);
s2.add(18);
String expecting = "{15, 18}";
String result = (s2.and(s)).toString();
assertEquals(expecting, result);
}
use of org.antlr.v4.misc.EscapeSequenceParsing.Result in project antlr4 by antlr.
the class TestIntervalSet method testSubtractOfRangeSpanningMultipleRanges.
@Test
public void testSubtractOfRangeSpanningMultipleRanges() throws Exception {
IntervalSet s = IntervalSet.of(10, 20);
s.add(30, 40);
// s has 3 ranges now: 10..20, 30..40, 50..60
s.add(50, 60);
// covers one and touches 2nd range
IntervalSet s2 = IntervalSet.of(5, 55);
String expecting = "{56..60}";
String result = (s.subtract(s2)).toString();
assertEquals(expecting, result);
// touches both
IntervalSet s3 = IntervalSet.of(15, 55);
expecting = "{10..14, 56..60}";
result = (s.subtract(s3)).toString();
assertEquals(expecting, result);
}
use of org.antlr.v4.misc.EscapeSequenceParsing.Result in project antlr4 by antlr.
the class TestIntervalSet method testRmSingleElement.
@Test
public void testRmSingleElement() throws Exception {
IntervalSet s = IntervalSet.of(1, 10);
s.add(-3, -3);
s.remove(-3);
String expecting = "{1..10}";
String result = s.toString();
assertEquals(expecting, result);
}
Aggregations