aboutsummaryrefslogtreecommitdiff
path: root/quick_test.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-02-11 08:41:22 -0700
committerBen Johnson <benbjohnson@yahoo.com>2014-02-11 09:17:48 -0700
commit01774c35cfb7ed1c32d35b2561f080d9b734038c (patch)
treec696f61c0e7cf9905bb81ec7a099c22349e6c532 /quick_test.go
parentMerge pull request #20 from benbjohnson/freelist (diff)
downloaddedo-01774c35cfb7ed1c32d35b2561f080d9b734038c.tar.gz
dedo-01774c35cfb7ed1c32d35b2561f080d9b734038c.tar.xz
Cursor iteration.
Diffstat (limited to 'quick_test.go')
-rw-r--r--quick_test.go5
1 files changed, 5 insertions, 0 deletions
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)