Search in sources :

Example 6 with MutableBooleanSet

use of org.eclipse.collections.api.set.primitive.MutableBooleanSet in project eclipse-collections by eclipse.

the class AbstractBooleanSetTestCase method with.

@Override
@Test
public void with() {
    super.with();
    MutableBooleanCollection emptySet = this.newWith();
    MutableBooleanCollection set = emptySet.with(false);
    MutableBooleanSet set1 = this.newWith().with(true);
    MutableBooleanSet set2 = this.newWith().with(true).with(false);
    MutableBooleanSet set3 = this.newWith().with(false).with(true);
    Assert.assertSame(emptySet, set);
    Assert.assertEquals(this.setWithFalse, set);
    Assert.assertEquals(this.setWithTrue, set1);
    Assert.assertEquals(this.setWithTrueFalse, set2);
    Assert.assertEquals(this.setWithTrueFalse, set3);
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), this.setWithTrueFalse.with(true));
}
Also used : MutableBooleanCollection(org.eclipse.collections.api.collection.primitive.MutableBooleanCollection) MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 7 with MutableBooleanSet

use of org.eclipse.collections.api.set.primitive.MutableBooleanSet in project eclipse-collections by eclipse.

the class AbstractBooleanSetTestCase method newCollectionWith.

@Override
@Test
public void newCollectionWith() {
    MutableBooleanSet set = this.classUnderTest();
    Verify.assertSize(2, set);
    Assert.assertTrue(set.containsAll(true, false, true));
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 8 with MutableBooleanSet

use of org.eclipse.collections.api.set.primitive.MutableBooleanSet in project eclipse-collections by eclipse.

the class AbstractBooleanSetTestCase method add.

@Override
@Test
public void add() {
    Assert.assertTrue(this.emptySet.add(true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true), this.emptySet);
    MutableBooleanSet set = this.newWith();
    Assert.assertTrue(set.add(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(false), set);
    Assert.assertFalse(this.setWithFalse.add(false));
    Assert.assertTrue(this.setWithFalse.add(true));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), this.setWithFalse);
    Assert.assertFalse(this.setWithTrue.add(true));
    Assert.assertTrue(this.setWithTrue.add(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), this.setWithTrue);
    Assert.assertFalse(this.setWithTrueFalse.add(true));
    Assert.assertFalse(this.setWithTrueFalse.add(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true, false), this.setWithTrueFalse);
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 9 with MutableBooleanSet

use of org.eclipse.collections.api.set.primitive.MutableBooleanSet in project eclipse-collections by eclipse.

the class AbstractBooleanSetTestCase method remove.

@Override
@Test
public void remove() {
    Assert.assertTrue(this.setWithTrueFalse.remove(true));
    Assert.assertEquals(BooleanHashSet.newSetWith(false), this.setWithTrueFalse);
    MutableBooleanSet set = this.newWith(true, false);
    Assert.assertTrue(set.remove(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(true), set);
    Assert.assertFalse(this.setWithTrue.remove(false));
    Assert.assertTrue(this.setWithTrue.remove(true));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithTrue);
    Assert.assertFalse(this.setWithFalse.remove(true));
    Assert.assertTrue(this.setWithFalse.remove(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.setWithFalse);
    Assert.assertFalse(this.emptySet.remove(true));
    Assert.assertFalse(this.emptySet.remove(false));
    Assert.assertEquals(BooleanHashSet.newSetWith(), this.emptySet);
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Example 10 with MutableBooleanSet

use of org.eclipse.collections.api.set.primitive.MutableBooleanSet in project eclipse-collections by eclipse.

the class SynchronizedBooleanSetTest method asSynchronized.

@Override
@Test
public void asSynchronized() {
    super.asSynchronized();
    SynchronizedBooleanSet set = this.classUnderTest();
    MutableBooleanSet setWithLockObject = new SynchronizedBooleanSet(BooleanHashSet.newSetWith(true, false, true), new Object()).asSynchronized();
    Assert.assertEquals(set, setWithLockObject);
    Assert.assertSame(setWithLockObject, setWithLockObject.asSynchronized());
    Assert.assertSame(set, set.asSynchronized());
    Assert.assertEquals(set, set.asSynchronized());
}
Also used : MutableBooleanSet(org.eclipse.collections.api.set.primitive.MutableBooleanSet) Test(org.junit.Test)

Aggregations

MutableBooleanSet (org.eclipse.collections.api.set.primitive.MutableBooleanSet)16 Test (org.junit.Test)11 BooleanHashSet (org.eclipse.collections.impl.set.mutable.primitive.BooleanHashSet)5 BooleanArrayList (org.eclipse.collections.impl.list.mutable.primitive.BooleanArrayList)3 MutableBooleanCollection (org.eclipse.collections.api.collection.primitive.MutableBooleanCollection)2