use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method makeString.
@Test
public void makeString() {
Assert.assertEquals("true", this.newWith(true).makeString("/"));
Assert.assertEquals("", this.newWith().makeString());
Assert.assertEquals("", this.newWith().makeString("/"));
Assert.assertEquals("[]", this.newWith().makeString("[", "/", "]"));
BooleanIterable iterable = this.newWith(true, false);
Assert.assertTrue("true, false".equals(iterable.makeString()) || "false, true".equals(iterable.makeString()));
Assert.assertTrue(iterable.makeString("/"), "true/false".equals(iterable.makeString("/")) || "false/true".equals(iterable.makeString("/")));
Assert.assertTrue(iterable.makeString("[", "/", "]"), "[true/false]".equals(iterable.makeString("[", "/", "]")) || "[false/true]".equals(iterable.makeString("[", "/", "]")));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method containsAllIterable.
@Test
public void containsAllIterable() {
BooleanIterable emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.containsAll(new BooleanArrayList()));
Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(false)));
BooleanIterable booleanIterable = this.classUnderTest();
int size = booleanIterable.size();
Assert.assertTrue(booleanIterable.containsAll(new BooleanArrayList()));
Assert.assertEquals(size >= 1, booleanIterable.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertEquals(size >= 2, booleanIterable.containsAll(BooleanArrayList.newListWith(false)));
Assert.assertEquals(size >= 2, booleanIterable.containsAll(BooleanArrayList.newListWith(true, false)));
BooleanIterable iterable = this.newWith(true, true, false, false, false);
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(false)));
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, false)));
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, true)));
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(false, false)));
Assert.assertTrue(iterable.containsAll(BooleanArrayList.newListWith(true, false, true)));
Assert.assertFalse(this.newWith(true, true).containsAll(BooleanArrayList.newListWith(false, true, false)));
BooleanIterable trueCollection = this.newWith(true, true, true, true);
Assert.assertFalse(trueCollection.containsAll(BooleanArrayList.newListWith(true, false)));
BooleanIterable falseCollection = this.newWith(false, false, false, false);
Assert.assertFalse(falseCollection.containsAll(BooleanArrayList.newListWith(true, false)));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method testEquals.
@Test
public void testEquals() {
BooleanIterable iterable1 = this.newWith(true, false, true, false);
BooleanIterable iterable2 = this.newWith(true, false, true, false);
BooleanIterable iterable3 = this.newWith(false, false, false, true);
BooleanIterable iterable4 = this.newWith(true, true, true);
BooleanIterable iterable5 = this.newWith(true, true, false, false, false);
BooleanIterable iterable6 = this.newWith(true);
Verify.assertEqualsAndHashCode(iterable1, iterable2);
Verify.assertEqualsAndHashCode(this.newWith(), this.newWith());
Verify.assertPostSerializedEqualsAndHashCode(iterable6);
Verify.assertPostSerializedEqualsAndHashCode(iterable1);
Verify.assertPostSerializedEqualsAndHashCode(iterable5);
Assert.assertNotEquals(iterable1, iterable3);
Assert.assertNotEquals(iterable1, iterable4);
Assert.assertNotEquals(this.newWith(), this.newWith(true));
Assert.assertNotEquals(iterable6, this.newWith(true, false));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method reject.
@Test
public void reject() {
BooleanIterable iterable = this.classUnderTest();
int size = iterable.size();
int halfSize = size / 2;
Verify.assertSize(halfSize, iterable.reject(BooleanPredicates.isTrue()));
Verify.assertSize((size & 1) == 1 ? halfSize + 1 : halfSize, iterable.reject(BooleanPredicates.isFalse()));
BooleanIterable iterable1 = this.newWith(false, true, false, false, true, true, true);
Assert.assertEquals(this.newMutableCollectionWith(false, false, false), iterable1.reject(BooleanPredicates.isTrue()));
Assert.assertEquals(this.newMutableCollectionWith(true, true, true, true), iterable1.reject(BooleanPredicates.isFalse()));
}
use of org.eclipse.collections.api.BooleanIterable in project eclipse-collections by eclipse.
the class AbstractBooleanIterableTestCase method testToString.
@Test
public void testToString() {
Assert.assertEquals("[]", this.newWith().toString());
Assert.assertEquals("[true]", this.newWith(true).toString());
BooleanIterable iterable = this.newWith(true, false);
Assert.assertTrue("[true, false]".equals(iterable.toString()) || "[false, true]".equals(iterable.toString()));
}
Aggregations