use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method withAll.
@Test
public void withAll() {
MutableBooleanCollection emptyCollection = this.newWith();
MutableBooleanCollection collection = emptyCollection.withAll(this.newMutableCollectionWith(true));
MutableBooleanCollection collection0 = this.newWith().withAll(this.newMutableCollectionWith(true, false));
MutableBooleanCollection collection1 = this.newWith().withAll(this.newMutableCollectionWith(true, false, true));
MutableBooleanCollection collection2 = this.newWith().withAll(this.newMutableCollectionWith(true, false, true, false));
MutableBooleanCollection collection3 = this.newWith().withAll(this.newMutableCollectionWith(true, false, true, false, true));
Assert.assertSame(emptyCollection, collection);
Assert.assertEquals(this.newMutableCollectionWith(true), collection);
Assert.assertEquals(this.newMutableCollectionWith(true, false), collection0);
Assert.assertEquals(this.classUnderTest(), collection1);
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false), collection2);
Assert.assertEquals(this.newMutableCollectionWith(true, false, true, false, true), collection3);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method containsAllIterable.
@Override
@Test
public void containsAllIterable() {
super.containsAllIterable();
MutableBooleanCollection emptyCollection = this.newWith();
Assert.assertTrue(emptyCollection.containsAll(new BooleanArrayList()));
Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(false)));
emptyCollection.add(false);
Assert.assertFalse(emptyCollection.containsAll(BooleanArrayList.newListWith(true)));
Assert.assertTrue(emptyCollection.containsAll(BooleanArrayList.newListWith(false)));
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method clear.
@Test
public void clear() {
MutableBooleanCollection collection = this.classUnderTest();
collection.clear();
Verify.assertSize(0, collection);
Verify.assertEmpty(collection);
Assert.assertFalse(collection.contains(true));
Assert.assertFalse(collection.contains(false));
MutableBooleanCollection collection0 = this.newWith();
MutableBooleanCollection collection1 = this.newWith(false);
MutableBooleanCollection collection2 = this.newWith(true);
MutableBooleanCollection collection3 = this.newWith(true, false);
MutableBooleanCollection collection4 = this.newWith(true, false, true, false, true);
collection0.clear();
collection1.clear();
collection2.clear();
collection3.clear();
collection4.clear();
Verify.assertEmpty(collection0);
Verify.assertEmpty(collection1);
Verify.assertEmpty(collection2);
Verify.assertEmpty(collection3);
Verify.assertEmpty(collection4);
Verify.assertSize(0, collection0);
Verify.assertSize(0, collection1);
Verify.assertSize(0, collection2);
Verify.assertSize(0, collection3);
Verify.assertSize(0, collection4);
Assert.assertFalse(collection1.contains(false));
Assert.assertFalse(collection2.contains(true));
Assert.assertFalse(collection3.contains(true));
Assert.assertFalse(collection3.contains(false));
Assert.assertFalse(collection4.contains(false));
Assert.assertEquals(this.newMutableCollectionWith(), collection0);
Assert.assertEquals(this.newMutableCollectionWith(), collection1);
Assert.assertEquals(this.newMutableCollectionWith(), collection2);
Assert.assertEquals(this.newMutableCollectionWith(), collection3);
Assert.assertEquals(this.newMutableCollectionWith(), collection4);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method booleanIterator_with_remove.
@Test
public void booleanIterator_with_remove() {
MutableBooleanCollection booleanIterable = this.classUnderTest();
MutableBooleanIterator iterator = booleanIterable.booleanIterator();
int iterationCount = booleanIterable.size();
int iterableSize = booleanIterable.size();
for (int i = 0; i < iterationCount; i++) {
Verify.assertSize(iterableSize--, booleanIterable);
Assert.assertTrue(iterator.hasNext());
iterator.next();
iterator.remove();
Verify.assertSize(iterableSize, booleanIterable);
}
Verify.assertEmpty(booleanIterable);
Assert.assertFalse(iterator.hasNext());
Verify.assertThrows(NoSuchElementException.class, (Runnable) iterator::next);
}
use of org.eclipse.collections.api.collection.primitive.MutableBooleanCollection in project eclipse-collections by eclipse.
the class AbstractMutableBooleanCollectionTestCase method removeAll_iterable.
@Test
public void removeAll_iterable() {
MutableBooleanCollection collection = this.classUnderTest();
Assert.assertFalse(collection.removeAll(this.newMutableCollectionWith()));
Assert.assertTrue(collection.removeAll(this.newMutableCollectionWith(false)));
Assert.assertEquals(this.newMutableCollectionWith(true, true), collection);
Assert.assertTrue(collection.removeAll(this.newMutableCollectionWith(true, true)));
Assert.assertEquals(this.newMutableCollectionWith(), collection);
MutableBooleanCollection list = this.classUnderTest();
Assert.assertFalse(list.removeAll(new BooleanArrayList()));
MutableBooleanCollection booleanArrayList = this.newWith(false, false);
Assert.assertFalse(booleanArrayList.removeAll(new BooleanArrayList(true)));
Assert.assertEquals(this.newMutableCollectionWith(false, false), booleanArrayList);
Assert.assertTrue(booleanArrayList.removeAll(new BooleanArrayList(false)));
Assert.assertEquals(this.newMutableCollectionWith(), booleanArrayList);
Assert.assertTrue(list.removeAll(new BooleanArrayList(true)));
Assert.assertEquals(this.newMutableCollectionWith(false), list);
Assert.assertTrue(list.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(this.newMutableCollectionWith(), list);
Assert.assertFalse(list.removeAll(BooleanArrayList.newListWith(true, false)));
Assert.assertEquals(this.newMutableCollectionWith(), list);
MutableBooleanCollection list1 = this.newWith(true, false, true, true);
Assert.assertFalse(list1.removeAll(new BooleanArrayList()));
Assert.assertTrue(list1.removeAll(BooleanArrayList.newListWith(true, true)));
Verify.assertSize(1, list1);
Assert.assertFalse(list1.contains(true));
Assert.assertEquals(this.newMutableCollectionWith(false), list1);
Assert.assertTrue(list1.removeAll(BooleanArrayList.newListWith(false, false)));
Assert.assertEquals(this.newMutableCollectionWith(), list1);
MutableBooleanCollection list2 = this.newWith(true, false, true, false, true);
Assert.assertTrue(list2.removeAll(BooleanHashBag.newBagWith(true, false)));
Assert.assertEquals(this.newMutableCollectionWith(), list2);
}
Aggregations