aboutsummaryrefslogtreecommitdiff
path: root/c/cursor_test.go
diff options
context:
space:
mode:
authorMartin Kobetic <mkobetic@gmail.com>2014-04-23 14:00:53 +0000
committerMartin Kobetic <mkobetic@gmail.com>2014-04-23 14:00:53 +0000
commit9d095430b446e19198c35c05f311957306de82f5 (patch)
tree4f15f66b4dbef450fff1a40447c568ba020c6df1 /c/cursor_test.go
parentadd deep tree tests, some cleanup (diff)
downloaddedo-9d095430b446e19198c35c05f311957306de82f5.tar.gz
dedo-9d095430b446e19198c35c05f311957306de82f5.tar.xz
fix deep search
Diffstat (limited to 'c/cursor_test.go')
-rw-r--r--c/cursor_test.go12
1 files changed, 12 insertions, 0 deletions
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))