Search in sources :

Example 26 with IntIterator

use of kodkod.util.ints.IntIterator in project org.alloytools.alloy by AlloyTools.

the class BugTests method testEmina_01192006.

public final void testEmina_01192006() {
    IntBitSet s = new IntBitSet(64);
    for (int i = 4; i < 8; i++) {
        for (int j = 0; j < 4; j++) {
            s.add(i * 8 + j);
        }
    }
    // System.out.println(s);
    for (int i = 4; i < 8; i++) {
        assertTrue(s.iterator(i * 8, (i + 1) * 8 - 1).hasNext());
        int count = 0;
        for (IntIterator iter = s.iterator(i * 8, (i + 1) * 8 - 1); iter.hasNext(); ) {
            count += iter.next() % 8;
        }
        assertEquals(count, 6);
    }
    for (int i = 4; i < 8; i++) {
        assertTrue(s.iterator((i + 1) * 8 - 1, i * 8).hasNext());
        int count = 0;
        for (IntIterator iter = s.iterator((i + 1) * 8 - 1, i * 8); iter.hasNext(); ) {
            count += iter.next() % 8;
        }
        assertEquals(count, 6);
    }
}
Also used : IntBitSet(kodkod.util.ints.IntBitSet) IntIterator(kodkod.util.ints.IntIterator)

Example 27 with IntIterator

use of kodkod.util.ints.IntIterator in project org.alloytools.alloy by AlloyTools.

the class BugTests method testVincent_02132006.

public final void testVincent_02132006() {
    IntTreeSet set = new IntTreeSet();
    for (int i = 0; i < 2; i++) {
        set.add(i);
    }
    IntTreeSet set2 = new IntTreeSet();
    for (int i = 0; i < 2; i++) {
        set2.add(i);
    }
    set.removeAll(set2);
    IntIterator setIterator = set.iterator();
    assertFalse(setIterator.hasNext());
    assertFalse(setIterator.hasNext());
    set.addAll(set2);
    assertSameContents(set, 0, 1);
    set2.clear();
    for (int i = 3; i < 5; i++) {
        set2.add(i);
    }
    set.addAll(set2);
    assertSameContents(set, 0, 1, 3, 4);
    set2.clear();
    for (int i = 1; i < 4; i++) {
        set2.add(i);
    }
    set.addAll(set2);
    assertSameContents(set, 0, 1, 2, 3, 4);
}
Also used : IntIterator(kodkod.util.ints.IntIterator) IntTreeSet(kodkod.util.ints.IntTreeSet)

Aggregations

IntIterator (kodkod.util.ints.IntIterator)27 IntSet (kodkod.util.ints.IntSet)21 IntBitSet (kodkod.util.ints.IntBitSet)7 Relation (kodkod.ast.Relation)5 Clause (kodkod.engine.satlab.Clause)5 BooleanMatrix (kodkod.engine.bool.BooleanMatrix)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 BooleanFactory (kodkod.engine.bool.BooleanFactory)2 BooleanValue (kodkod.engine.bool.BooleanValue)2 TupleFactory (kodkod.instance.TupleFactory)2 TupleSet (kodkod.instance.TupleSet)2 IntTreeSet (kodkod.util.ints.IntTreeSet)2 Comparator (java.util.Comparator)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 BooleanAccumulator (kodkod.engine.bool.BooleanAccumulator)1 Int (kodkod.engine.bool.Int)1 SATSolver (kodkod.engine.satlab.SATSolver)1 Instance (kodkod.instance.Instance)1