Search in sources :

Example 16 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method removeAll.

@Override
@Test
public void removeAll() {
    super.removeAll();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(set.removeAll());
    Assert.assertFalse(set.removeAll(15L, AbstractLongSetTestCase.generateCollisions1().get(2), AbstractLongSetTestCase.generateCollisions1().get(3)));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.removeAll(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(3)));
    Assert.assertEquals(LongHashSet.newSetWith(1L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.removeAll(1L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)));
    Assert.assertEquals(new LongHashSet(), set);
    Assert.assertFalse(set.removeAll(1L));
    Assert.assertEquals(new LongHashSet(), set);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 17 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method select.

@Override
@Test
public void select() {
    super.select();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Verify.assertSize(3, set.select(LongPredicates.lessThan(32L)));
    Verify.assertSize(4, set.select(LongPredicates.greaterThan(0L)));
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 18 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method retainAll_iterable.

@Override
@Test
public void retainAll_iterable() {
    super.retainAll_iterable();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(set.retainAll(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.retainAll(LongHashSet.newSetWith(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(4), AbstractLongSetTestCase.generateCollisions1().get(1))));
    Assert.assertEquals(LongHashSet.newSetWith(0L, 31L, AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    Assert.assertTrue(set.retainAll(LongHashSet.newSetWith(1L, AbstractLongSetTestCase.generateCollisions1().getFirst())));
    Assert.assertEquals(new LongHashSet(), set);
    Assert.assertFalse(set.retainAll(LongHashSet.newSetWith(1L)));
    Assert.assertEquals(new LongHashSet(), set);
}
Also used : LongHashSet(org.eclipse.collections.impl.set.mutable.primitive.LongHashSet) MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 19 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method clear.

@Override
@Test
public void clear() {
    super.clear();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    set.clear();
    Verify.assertSize(0, set);
    Assert.assertFalse(set.contains(0L));
    Assert.assertFalse(set.contains(31L));
    Assert.assertFalse(set.contains(1L));
    Assert.assertFalse(set.contains(AbstractLongSetTestCase.generateCollisions1().getFirst()));
    Assert.assertFalse(set.contains(AbstractLongSetTestCase.generateCollisions1().get(1)));
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Example 20 with MutableLongSet

use of org.eclipse.collections.api.set.primitive.MutableLongSet in project mapdb by jankotek.

the class AbstractLongSetTestCase method remove.

@Override
@Test
public void remove() {
    super.remove();
    MutableLongSet set = this.newWith(0L, 1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1));
    Assert.assertFalse(this.newWith().remove(15L));
    Assert.assertFalse(set.remove(15L));
    Assert.assertTrue(set.remove(0L));
    Assert.assertEquals(LongHashSet.newSetWith(1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst(), AbstractLongSetTestCase.generateCollisions1().get(1)), set);
    //        Assert.assertFalse(set.remove(AbstractLongSetTestCase.generateNonCollisions().getFirst()));
    Assert.assertFalse(set.remove(AbstractLongSetTestCase.generateCollisions1().get(3)));
    Assert.assertTrue(set.remove(AbstractLongSetTestCase.generateCollisions1().get(1)));
    Assert.assertEquals(LongHashSet.newSetWith(1L, 31L, AbstractLongSetTestCase.generateCollisions1().getFirst()), set);
    Assert.assertTrue(set.remove(AbstractLongSetTestCase.generateCollisions1().getFirst()));
    Assert.assertEquals(LongHashSet.newSetWith(1L, 31L), set);
    Assert.assertTrue(set.remove(31L));
    Assert.assertEquals(LongHashSet.newSetWith(1L), set);
    Assert.assertTrue(set.remove(1L));
    Assert.assertEquals(LongHashSet.newSetWith(), set);
}
Also used : MutableLongSet(org.eclipse.collections.api.set.primitive.MutableLongSet) Test(org.junit.Test)

Aggregations

MutableLongSet (org.eclipse.collections.api.set.primitive.MutableLongSet)26 Test (org.junit.Test)24 LongHashSet (org.eclipse.collections.impl.set.mutable.primitive.LongHashSet)5 LongIterator (org.eclipse.collections.api.iterator.LongIterator)3 LongArrayList (org.eclipse.collections.impl.list.mutable.primitive.LongArrayList)2