}
@Test
@Repeat(iterations = 20)
public void testAgainstReferenceOpenIntHashSet() {
AbstractIntSet base = new OpenIntHashSet();
HashSet<Integer> reference = Sets.newHashSet();
List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
addOp(ops, Operation.CLEAR, 5);
addOp(ops, Operation.ISEMPTY, 2);
addOp(ops, Operation.SIZE, 2);
int max = randomIntBetween(1000, 20000);
for (int reps = 0; reps < max; reps++) {
// Ensure some collisions among keys.
int k = randomIntBetween(0, max / 4);
switch (randomFrom(ops)) {
case ADD:
assertEquals(reference.add(k), base.add(k));
break;
case REMOVE:
assertEquals(reference.remove(k), base.remove(k));
break;
case INDEXOF:
assertEquals(reference.contains(k), base.contains(k));
break;
case CLEAR:
reference.clear();
base.clear();
break;
case ISEMPTY:
assertEquals(reference.isEmpty(), base.isEmpty());
break;
case SIZE:
assertEquals(reference.size(), base.size());
break;
default:
throw new RuntimeException();
}