]> git.saurik.com Git - redis.git/commitdiff
Make SORT tests use both ziplists and linked lists as input
authorPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 21 Aug 2010 09:02:22 +0000 (11:02 +0200)
committerPieter Noordhuis <pcnoordhuis@gmail.com>
Sat, 21 Aug 2010 09:02:22 +0000 (11:02 +0200)
tests/unit/sort.tcl

index 554477d1efe70bd515b035d75d0fa6a982cd4ddd..8f2710cdb87ebac2540284f387b8a5159db89550 100644 (file)
@@ -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 #]
     }