use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method containsAllIterable.
@Test
public void containsAllIterable() {
LongIterable source = this.classUnderTest();
Assert.assertTrue(source.containsAll(this.classUnderTest()));
Assert.assertFalse(source.containsAll(LongArrayList.newListWith(source.size() + 1)));
LongIterable iterable = this.newWith(1L, 2L, 3L);
Assert.assertTrue(this.newWith().containsAll(new LongArrayList()));
Assert.assertFalse(this.newWith().containsAll(LongArrayList.newListWith(1L)));
Assert.assertTrue(iterable.containsAll(LongArrayList.newListWith(1L)));
Assert.assertTrue(iterable.containsAll(LongArrayList.newListWith(1L, 2L, 3L)));
Assert.assertFalse(iterable.containsAll(LongArrayList.newListWith(1L, 2L, 3L, 4L)));
Assert.assertFalse(iterable.containsAll(LongArrayList.newListWith(1L, 2L, 4L)));
Assert.assertFalse(iterable.containsAll(LongArrayList.newListWith(4L, 5L, 6L)));
LongIterable iterable1 = this.newWith(14L, 2L, 30L, 32L, 35L, 0L, 1L);
Assert.assertTrue(iterable1.containsAll(LongHashSet.newSetWith(14L)));
Assert.assertTrue(iterable1.containsAll(LongHashSet.newSetWith(35L)));
Assert.assertFalse(iterable1.containsAll(LongHashSet.newSetWith(-1L)));
Assert.assertTrue(iterable1.containsAll(LongHashSet.newSetWith(14L, 1L, 30L)));
Assert.assertTrue(iterable1.containsAll(LongHashSet.newSetWith(14L, 1L, 32L)));
Assert.assertTrue(iterable1.containsAll(LongHashSet.newSetWith(14L, 1L, 35L)));
Assert.assertFalse(iterable1.containsAll(LongHashSet.newSetWith(0L, 2L, 35L, -1L)));
Assert.assertFalse(iterable1.containsAll(LongHashSet.newSetWith(31L, -1L)));
LongIterable iterable2 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
Assert.assertTrue(iterable2.containsAll(LongArrayList.newListWith(0L)));
Assert.assertTrue(iterable2.containsAll(LongArrayList.newListWith(0L, 0L, 0L)));
Assert.assertTrue(iterable2.containsAll(LongArrayList.newListWith(0L, 1L, 1L)));
Assert.assertTrue(iterable2.containsAll(LongArrayList.newListWith(0L, 1L, 2L)));
Assert.assertFalse(iterable2.containsAll(LongArrayList.newListWith(0L, 1L, 2L, 3L, 4L)));
Assert.assertFalse(iterable2.containsAll(LongArrayList.newListWith(3L, 4L)));
}
use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method reject.
@Test
public void reject() {
LongIterable iterable = this.classUnderTest();
int size = iterable.size();
Verify.assertSize(size <= 3 ? 0 : size - 3, iterable.reject(LongPredicates.lessThan(4L)));
Verify.assertSize(size <= 2 ? 0 : size - 2, iterable.reject(LongPredicates.lessThan(3L)));
LongIterable iterable1 = this.newWith(0L, 1L, 2L, 2L, 3L, 3L, 3L);
Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 3L, 3L, 3L), iterable1.reject(LongPredicates.lessThan(2L)));
Assert.assertEquals(this.newMutableCollectionWith(0L, 1L), iterable1.reject(LongPredicates.greaterThan(1L)));
}
use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method testToString.
@Test
public void testToString() {
Assert.assertEquals("[]", this.newWith().toString());
Assert.assertEquals("[1]", this.newWith(1L).toString());
Assert.assertEquals("[31]", this.newWith(31L).toString());
Assert.assertEquals("[32]", this.newWith(32L).toString());
LongIterable iterable = this.newWith(1L, 2L);
Assert.assertTrue("[1, 2]".equals(iterable.toString()) || "[2, 1]".equals(iterable.toString()));
LongIterable iterable1 = this.newWith(0L, 31L);
Assert.assertTrue(iterable1.toString(), iterable1.toString().equals("[0, 31]") || iterable1.toString().equals("[31, 0]"));
LongIterable iterable2 = this.newWith(31L, 32L);
Assert.assertTrue(iterable2.toString(), iterable2.toString().equals("[31, 32]") || iterable2.toString().equals("[32, 31]"));
LongIterable iterable3 = this.newWith(32L, 33L);
Assert.assertTrue(iterable3.toString(), iterable3.toString().equals("[32, 33]") || iterable3.toString().equals("[33, 32]"));
LongIterable iterable4 = this.newWith(0L, 1L);
Assert.assertTrue(iterable4.toString(), iterable4.toString().equals("[0, 1]") || iterable4.toString().equals("[1, 0]"));
}
use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method containsAllArray.
@Test
public void containsAllArray() {
Assert.assertTrue(this.classUnderTest().containsAll(this.classUnderTest().toArray()));
Assert.assertFalse(this.classUnderTest().containsAll(this.classUnderTest().size() + 1));
LongIterable iterable = this.newWith(1L, 2L, 3L);
Assert.assertTrue(iterable.containsAll(1L));
Assert.assertTrue(iterable.containsAll(1L, 2L, 3L));
Assert.assertFalse(iterable.containsAll(1L, 2L, 3L, 4L));
Assert.assertFalse(iterable.containsAll(1L, 2L, 4L));
Assert.assertFalse(iterable.containsAll(4L, 5L, 6L));
LongIterable iterable1 = this.newWith(14L, 2L, 30L, 32L, 35L, 0L, 1L);
Assert.assertTrue(iterable1.containsAll(14L));
Assert.assertTrue(iterable1.containsAll(35L));
Assert.assertFalse(iterable1.containsAll(-1L));
Assert.assertTrue(iterable1.containsAll(14L, 1L, 30L));
Assert.assertTrue(iterable1.containsAll(14L, 1L, 32L));
Assert.assertTrue(iterable1.containsAll(14L, 1L, 35L));
Assert.assertFalse(iterable1.containsAll(0L, 2L, 35L, -1L));
Assert.assertFalse(iterable1.containsAll(31L, -1L));
LongIterable iterable2 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
Assert.assertTrue(iterable2.containsAll(0L));
Assert.assertTrue(iterable2.containsAll(0L, 0L, 0L));
Assert.assertTrue(iterable2.containsAll(0L, 1L, 1L));
Assert.assertTrue(iterable2.containsAll(0L, 1L, 2L));
Assert.assertFalse(iterable2.containsAll(0L, 1L, 2L, 3L, 4L));
Assert.assertFalse(iterable2.containsAll(3L, 4L));
}
use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method testEquals.
@Test
public void testEquals() {
LongIterable iterable1 = this.newWith(1L, 2L, 3L, 4L);
LongIterable iterable2 = this.newWith(1L, 2L, 3L, 4L);
LongIterable iterable3 = this.newWith(5L, 6L, 7L, 8L);
LongIterable iterable4 = this.newWith(5L, 6L, 7L);
LongIterable iterable5 = this.newWith(0L, 1L, 1L, 2L, 2L, 2L);
LongIterable iterable6 = this.newWith(1L, 31L, 32L);
LongIterable iterable7 = this.newWith(35L, 31L, 1L);
LongIterable iterable8 = this.newWith(32L, 31L, 1L, 50L);
LongIterable iterable9 = this.newWith(0L, 1L, 2L);
LongIterable iterable10 = this.newWith(0L, 1L, 3L);
LongIterable iterable11 = this.newWith(3L, 1L, 2L);
LongIterable iterable12 = this.newWith(3L);
Verify.assertEqualsAndHashCode(iterable1, iterable2);
Verify.assertPostSerializedEqualsAndHashCode(iterable1);
Verify.assertPostSerializedEqualsAndHashCode(iterable12);
Verify.assertPostSerializedEqualsAndHashCode(iterable5);
Verify.assertPostSerializedEqualsAndHashCode(iterable6);
Assert.assertNotEquals(iterable12, iterable11);
Assert.assertNotEquals(iterable1, iterable3);
Assert.assertNotEquals(iterable1, iterable4);
Assert.assertNotEquals(iterable6, iterable7);
Assert.assertNotEquals(iterable6, iterable8);
Assert.assertNotEquals(iterable9, iterable10);
Assert.assertNotEquals(iterable9, iterable11);
Assert.assertNotEquals(this.newWith(), this.newWith(100L));
}
Aggregations