use of jetbrains.exodus.env.Cursor in project xodus by JetBrains.
the class TreeCursorNoDuplicatesTest method testGetSearchBothRange1.
@Test
public void testGetSearchBothRange1() throws IOException {
Cursor c = getTreeMutable().openCursor();
for (int i = 0; i < s; i++) {
assertEquals(value("v" + i), c.getSearchBothRange(key(i), value("v" + i)));
assertEquals(c.getValue(), value("v" + i));
assertEquals(c.getKey(), key(i));
}
}
use of jetbrains.exodus.env.Cursor in project xodus by JetBrains.
the class TreeCursorNoDuplicatesTest method testGetSearchKey.
@Test
public void testGetSearchKey() throws IOException {
Cursor c = getTreeMutable().openCursor();
for (int i = 0; i < s; i++) {
assertEquals("v" + i, value("v" + i), c.getSearchKey(key(i)));
assertEquals(c.getValue(), value("v" + i));
assertEquals(c.getKey(), key(i));
}
assertFalse(c.getNext());
}
use of jetbrains.exodus.env.Cursor in project xodus by JetBrains.
the class TreeCursorNoDuplicatesTest method testGetSearchKeyRange5.
@Test
public void testGetSearchKeyRange5() throws IOException {
tm = createMutableTree(false, 1);
final ByteIterable v = value("0");
tm.put(key("aaba"), v);
tm.put(key("aabb"), v);
Cursor c = tm.openCursor();
assertNotNull(c.getSearchKeyRange(key("aababa")));
assertEquals(key("aabb"), c.getKey());
}
use of jetbrains.exodus.env.Cursor in project xodus by JetBrains.
the class TreeCursorNoDuplicatesTest method testGetSearchKeyRange4.
@Test
public void testGetSearchKeyRange4() throws IOException {
tm = createMutableTree(false, 1);
final ByteIterable v = value("0");
tm.put(key("aaaa"), v);
tm.put(key("aaab"), v);
tm.put(key("aaba"), v);
Cursor c = tm.openCursor();
c.getSearchKeyRange(key("aaac"));
assertEquals(key("aaba"), c.getKey());
}
use of jetbrains.exodus.env.Cursor in project xodus by JetBrains.
the class TreeCursorNoDuplicatesTest method testGetSearchKeyRange2.
@Test
public void testGetSearchKeyRange2() throws IOException {
tm = createMutableTree(false, 1);
getTreeMutable().put(key("10"), value("v10"));
getTreeMutable().put(key("20"), value("v20"));
getTreeMutable().put(key("30"), value("v30"));
getTreeMutable().put(key("40"), value("v40"));
getTreeMutable().put(key("50"), value("v50"));
getTreeMutable().put(key("60"), value("v60"));
Cursor c = getTreeMutable().openCursor();
assertEquals(value("v10"), c.getSearchKeyRange(key("01")));
assertEquals(key("10"), c.getKey());
assertEquals(value("v60"), c.getSearchKeyRange(key("55")));
assertEquals(key("60"), c.getKey());
assertEquals(null, c.getSearchKeyRange(key("61")));
// cursor keep prev pos
assertEquals(key("60"), c.getKey());
assertFalse(c.getNext());
}
Aggregations