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 select.
@Test
public void select() {
LongIterable iterable = this.classUnderTest();
int size = iterable.size();
Verify.assertSize(size >= 3 ? 3 : size, iterable.select(LongPredicates.lessThan(4L)));
Verify.assertSize(size >= 2 ? 2 : size, iterable.select(LongPredicates.lessThan(3L)));
LongIterable iterable1 = this.newWith(0L, 1L, 2L, 2L, 3L, 3L, 3L);
Assert.assertEquals(this.newMutableCollectionWith(0L, 1L), iterable1.select(LongPredicates.lessThan(2L)));
Assert.assertEquals(this.newMutableCollectionWith(2L, 2L, 3L, 3L, 3L), iterable1.select(LongPredicates.greaterThan(1L)));
}
use of org.eclipse.collections.api.LongIterable in project mapdb by jankotek.
the class AbstractLongIterableTestCase method noneSatisfy.
@Test
public void noneSatisfy() {
Assert.assertFalse(this.newWith(1L, 0L, 2L).noneSatisfy(LongPredicates.greaterThan(0L)));
Assert.assertFalse(this.newWith(1L, 0L, 2L).noneSatisfy(LongPredicates.equal(0L)));
Assert.assertTrue(this.newWith(1L, 2L, 3L).noneSatisfy(LongPredicates.greaterThan(3L)));
Assert.assertFalse(this.newWith(1L, 0L, 31L, 32L).noneSatisfy(LongPredicates.greaterThan(0L)));
Assert.assertFalse(this.newWith(1L, 0L, 31L, 32L).noneSatisfy(LongPredicates.greaterThan(0L)));
Assert.assertTrue(this.newWith(1L, 2L, 31L, 32L).noneSatisfy(LongPredicates.lessThan(0L)));
Assert.assertFalse(this.newWith(32L).noneSatisfy(LongPredicates.greaterThan(0L)));
LongIterable iterable = this.newWith(0L, 1L, 2L);
Assert.assertFalse(iterable.noneSatisfy(value -> 1L < value));
Assert.assertTrue(iterable.noneSatisfy(LongPredicates.greaterThan(3L)));
LongIterable iterable1 = this.classUnderTest();
int size = iterable1.size();
Assert.assertEquals(size <= 3, iterable1.noneSatisfy(LongPredicates.greaterThan(3L)));
Assert.assertEquals(size == 0, iterable1.noneSatisfy(LongPredicates.lessThan(3L)));
}
Aggregations