public class BasicIndexBipartiteSetTest {
@Test(groups = "1s")
public void test1() {
IEnvironment env = new EnvironmentTrailing();
BasicIndexedBipartiteSet set = new BasicIndexedBipartiteSet(env, 2);
int b1 = set.add();
int b2 = set.add();
int b3 = set.add();
int b4 = set.add();
set.swap(b2);
Assert.assertTrue(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertTrue(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
env.worldPush();
set.swap(b3); // b3 is now fixed
int b5 = set.add();
Assert.assertTrue(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertFalse(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
Assert.assertTrue(set.bundle(b5));
env.worldPush();
set.swap(b1); // b1 is now fixed
int b6 = set.add();
set.swap(b6);
Assert.assertFalse(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertFalse(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
Assert.assertTrue(set.bundle(b5));
Assert.assertFalse(set.bundle(b6));
// go back
env.worldPop();
Assert.assertTrue(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertFalse(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
Assert.assertTrue(set.bundle(b5));
Assert.assertTrue(set.bundle(b6));
env.worldPop();
Assert.assertTrue(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertTrue(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
Assert.assertTrue(set.bundle(b5));
Assert.assertTrue(set.bundle(b6));
env.worldPop();
Assert.assertTrue(set.bundle(b1));
Assert.assertFalse(set.bundle(b2));
Assert.assertTrue(set.bundle(b3));
Assert.assertTrue(set.bundle(b4));
Assert.assertTrue(set.bundle(b5));