summaryrefslogtreecommitdiff
path: root/tests/unit/sort.tcl
diff options
context:
space:
mode:
authorPieter Noordhuis <pcnoordhuis@gmail.com>2010-08-21 11:02:22 +0200
committerPieter Noordhuis <pcnoordhuis@gmail.com>2010-08-21 11:02:22 +0200
commitced6709cb9f4db367c58035f1ccb4a3ddd9c21cf (patch)
treed7b063aef41afdc4fb6f1876b3de14d498e92773 /tests/unit/sort.tcl
parent5d4f3a8c85e528b47d125a588f6255eeb1836e0f (diff)
downloadredis-ced6709cb9f4db367c58035f1ccb4a3ddd9c21cf.tar.gz
Make SORT tests use both ziplists and linked lists as input
Diffstat (limited to 'tests/unit/sort.tcl')
-rw-r--r--tests/unit/sort.tcl20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/unit/sort.tcl b/tests/unit/sort.tcl
index 554477d1e..8f2710cdb 100644
--- a/tests/unit/sort.tcl
+++ b/tests/unit/sort.tcl
@@ -34,15 +34,23 @@ start_server {
set _ $result
}
- set result [create_random_dataset 16 lpush]
- test "SORT BY key" {
- assert_equal $result [r sort tosort {BY weight_*}]
- }
+ foreach {num cmd enc title} {
+ 16 lpush ziplist "Ziplist"
+ 64 lpush linkedlist "Linked list"
+ } {
+ set result [create_random_dataset $num $cmd]
+ assert_encoding $enc tosort
+
+ test "$title: SORT BY key" {
+ assert_equal $result [r sort tosort {BY weight_*}]
+ }
- test "SORT BY hash field" {
- assert_equal $result [r sort tosort {BY wobj_*->weight}]
+ test "$title: SORT BY hash field" {
+ assert_equal $result [r sort tosort {BY wobj_*->weight}]
+ }
}
+ set result [create_random_dataset 16 lpush]
test "SORT GET #" {
assert_equal [lsort -integer $result] [r sort tosort GET #]
}