use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method toString_regular.
@Test
public void toString_regular() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
intSet.add(11);
intSet.add(22);
intSet.add(33);
String toString = intSet.toString();
assertTrue("ToString output should start with an opening square bracket.", toString.startsWith("["));
assertTrue("ToString output should end with a closing square bracket.", toString.endsWith("]"));
assertTrue("ToString output should contain the number 11.", toString.contains("11"));
assertTrue("ToString output should contain the number 22.", toString.contains("22"));
assertTrue("ToString output should contain the number 33.", toString.contains("33"));
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method removeAll_disjoint_set.
@Test
public void removeAll_disjoint_set() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
IntSet otherSet = PrimitiveSets.newIntOpenHashSet();
intSet.add(0);
intSet.add(5);
intSet.add(10);
otherSet.add(2);
otherSet.add(3);
otherSet.add(4);
intSet.removeAll(otherSet);
assertEquals("Integer set size should be 3.", 3, intSet.size());
assertTrue("Integer set should contain element 0.", intSet.contains(0));
assertTrue("Integer set should contain element 5.", intSet.contains(5));
assertTrue("Integer set should contain element 10.", intSet.contains(10));
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method add_twice.
@Test
public void add_twice() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
assertTrue("First attempt at adding 0 to the set should modify the set.", intSet.add(0));
assertTrue("First attempt at adding 5 to the set should modify the set.", intSet.add(5));
assertFalse("Second attempt at adding 0 to the set should not modify the set.", intSet.add(0));
assertFalse("Second attempt at adding 5 to the set should not modify the set.", intSet.add(5));
assertEquals("Integer set size should be 2.", 2, intSet.size());
assertTrue("Integer set should contain element 0.", intSet.contains(0));
assertTrue("Integer set should contain element 5.", intSet.contains(5));
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method iterator_overrun.
@Test(expected = NoSuchElementException.class)
public void iterator_overrun() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
IntIterator itr = intSet.iterator();
itr.next();
}
use of com.b2international.collections.ints.IntSet in project snow-owl by b2ihealthcare.
the class IntOpenHashSetTest method contains_false_after_remove.
@Test
public void contains_false_after_remove() {
IntSet intSet = PrimitiveSets.newIntOpenHashSet();
intSet.add(0);
intSet.add(5);
intSet.add(10);
intSet.remove(0);
intSet.remove(5);
intSet.remove(10);
assertEquals("Integer set size should be 0.", 0, intSet.size());
assertTrue("Integer set should be empty.", intSet.isEmpty());
assertFalse("Integer set should not contain element 0.", intSet.contains(0));
assertFalse("Integer set should not contain element 5.", intSet.contains(5));
assertFalse("Integer set should not contain element 10.", intSet.contains(10));
}
Aggregations