use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method add_twice.
@Test
public void add_twice() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
assertTrue("First attempt at adding 0 to the set should modify the set.", longSet.add(0L));
assertTrue("First attempt at adding 5 to the set should modify the set.", longSet.add(5L));
assertFalse("Second attempt at adding 0 to the set should not modify the set.", longSet.add(0L));
assertFalse("Second attempt at adding 5 to the set should not modify the set.", longSet.add(5L));
assertEquals("Long set size should be 2.", 2, longSet.size());
assertTrue("Long set should contain element 0.", longSet.contains(0L));
assertTrue("Long set should contain element 5.", longSet.contains(5L));
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method retainAll_empty_set.
@Test
public void retainAll_empty_set() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
LongSet otherSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
longSet.retainAll(otherSet);
assertTrue("Long set should be empty after retaining an empty set.", longSet.isEmpty());
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method equals_true.
@Test
public void equals_true() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
LongSet otherSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
otherSet.add(0L);
otherSet.add(5L);
otherSet.add(10L);
assertTrue("First set should be equal to second set.", longSet.equals(otherSet));
assertTrue("Second set should be equal to first set.", otherSet.equals(longSet));
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method toString_empty.
@Test
public void toString_empty() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
assertEquals("ToString output should be [] for the empty set.", "[]", longSet.toString());
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method retainAll_superset.
@Test
public void retainAll_superset() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
LongSet otherSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
otherSet.add(0L);
otherSet.add(5L);
otherSet.add(10L);
otherSet.add(30L);
longSet.retainAll(otherSet);
assertEquals("Three elements should remain after retaining.", 3, longSet.size());
assertTrue("Long set should contain element 0.", longSet.contains(0L));
assertTrue("Long set should contain element 5.", longSet.contains(5L));
assertTrue("Long set should contain element 10.", longSet.contains(10L));
}
Aggregations