From 01774c35cfb7ed1c32d35b2561f080d9b734038c Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 11 Feb 2014 08:41:22 -0700 Subject: Cursor iteration. --- quick_test.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'quick_test.go') diff --git a/quick_test.go b/quick_test.go index 4a107a8..3db0b6c 100644 --- a/quick_test.go +++ b/quick_test.go @@ -1,6 +1,7 @@ package bolt import ( + "bytes" "flag" "math/rand" "reflect" @@ -39,6 +40,10 @@ func qconfig() *quick.Config { type testdata []testdataitem +func (t testdata) Len() int { return len(t) } +func (t testdata) Swap(i, j int) { t[i], t[j] = t[j], t[i] } +func (t testdata) Less(i, j int) bool { return bytes.Compare(t[i].Key, t[j].Key) == -1 } + func (t testdata) Generate(rand *rand.Rand, size int) reflect.Value { n := rand.Intn(qmaxitems-1) + 1 items := make(testdata, n) -- cgit v1.2.3