From 9d095430b446e19198c35c05f311957306de82f5 Mon Sep 17 00:00:00 2001 From: Martin Kobetic Date: Wed, 23 Apr 2014 14:00:53 +0000 Subject: fix deep search --- c/cursor_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'c/cursor_test.go') diff --git a/c/cursor_test.go b/c/cursor_test.go index 46d2a58..3001115 100644 --- a/c/cursor_test.go +++ b/c/cursor_test.go @@ -56,6 +56,18 @@ func TestCursor_Seek(t *testing.T) { assert.Equal(t, "0003", string(v)) assert.Equal(t, 0, flags) + // Inexact match with smaller db key should go to the next key. + k, v, flags = c.Seek([]byte("barrrr")) + assert.Equal(t, "baz", string(k)) + assert.Equal(t, "0003", string(v)) + assert.Equal(t, 0, flags) + + // Inexact match with smaller seek key should go to the next key. + k, v, flags = c.Seek([]byte("ba")) + assert.Equal(t, "bar", string(k)) + assert.Equal(t, "0002", string(v)) + assert.Equal(t, 0, flags) + // Low key should go to the first key. k, v, flags = c.Seek([]byte("")) assert.Equal(t, "bar", string(k)) -- cgit v1.2.3