- Notifications
You must be signed in to change notification settings - Fork124
Closed
Description
Either I am not understanding something, or elseKeyRange.greaterThanBackward()
is broken.
The following test fails:
import java.io.*;import org.lmdbjava.*;import org.testng.Assert;import org.testng.annotations.Test;public class FooTest { @Test public void testFoo() throws Exception { // Create new empty directory File dir = File.createTempFile("foo.", null); Assert.assertTrue(dir.delete()); Assert.assertTrue(dir.mkdirs()); dir.deleteOnExit(); // Create new environment Env.Builder<byte[]> builder = Env.create(ByteArrayProxy.PROXY_BA); Env<byte[]> env = builder.open(dir); // Open database Dbi<byte[]> db = env.openDbi("foo", DbiFlags.MDB_CREATE); // Open transaction Txn<byte[]> tx = env.txnWrite(); // Put key/value pair db.put(tx, new byte[] { 1 }, new byte[] { 2 }); // Iterate range backwards - we should encounter the key/value pair we just put try (CursorIterator<byte[]> i = db.iterate(tx, KeyRange.greaterThanBackward(new byte[] { 3 }))) { Assert.assertTrue(i.hasNext()); // TEST FAILS HERE CursorIterator.KeyVal<byte[]> kv = i.next(); Assert.assertEquals(kv.key(), new byte[] { 1 }); Assert.assertEquals(kv.val(), new byte[] { 2 }); Assert.assertFalse(i.hasNext()); } // Commit transaction tx.commit(); // Close environment env.close(); }}
What am I missing? Thanks.
Metadata
Metadata
Assignees
Labels
No labels