Skip to content

Commit a9afe35

Browse files
committed
More IntCharSet tests
1 parent 3b1ddb0 commit a9afe35

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

jflex/src/test/java/jflex/core/IntCharSetTest.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,30 @@ public IntCharSetTest(String name) {
1515
}
1616

1717
public void testAddIntCharSet() {
18-
IntCharSet a = new IntCharSet((char) 0);
19-
a.add((char) 3);
18+
IntCharSet a = new IntCharSet(0);
19+
a.add(3);
2020
IntCharSet original_a = a.copy();
21-
IntCharSet b = new IntCharSet(new Interval((char) 0, (char) 4));
21+
IntCharSet b = new IntCharSet(0, 4);
2222
a.add(b);
2323
assertTrue(
2424
original_a + " + " + b + " should be " + b + " instead of " + a, Objects.equals(a, b));
2525
}
26+
27+
public void testContainsSet() {
28+
IntCharSet a = new IntCharSet(3, 7);
29+
a.add(new Interval(10, 15));
30+
IntCharSet b = new IntCharSet(4, 6);
31+
IntCharSet c = new IntCharSet(1, 5);
32+
IntCharSet d = new IntCharSet(1, 20);
33+
34+
assertTrue(a.contains(b));
35+
b.add(new Interval(10, 15));
36+
assertTrue(a.contains(b));
37+
a.sub(new IntCharSet(4, 7));
38+
a.sub(new IntCharSet(10, 15));
39+
assertTrue(!a.contains(b));
40+
assertTrue(!a.contains(c));
41+
assertTrue(!c.contains(d));
42+
assertTrue("d.contains(a); d is " + d + " and a is " + a, d.contains(a));
43+
}
2644
}

0 commit comments

Comments
 (0)