aboutsummaryrefslogtreecommitdiff
path: root/quick_test.go
diff options
context:
space:
mode:
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)