for (int i = 0; i < 100; i++) {
log("op #" + i);
// print(mk, tree);
int x = r.nextInt(10);
boolean exists = treeMap.containsKey(x);
Cursor c = tree.findFirst("" + x);
boolean gotExists = c.hasNext();
String x2 = null;
if (gotExists) {
x2 = c.next();
if (!x2.equals("" + x)) {
gotExists = false;
}
}
Assert.assertEquals("find " + x, exists, gotExists);
if (exists) {
Assert.assertEquals("" + x, x2);
Assert.assertEquals(treeMap.get(x), c.getValue());
}
boolean add = r.nextBoolean();
if (add) {
if (!exists) {
log("#insert " + x + " = p" + i);