]> git.saurik.com Git - redis.git/commitdiff
list test further split into smaller units
authorantirez <antirez@gmail.com>
Mon, 11 Jul 2011 09:41:23 +0000 (11:41 +0200)
committerantirez <antirez@gmail.com>
Mon, 11 Jul 2011 09:41:23 +0000 (11:41 +0200)
tests/test_helper.tcl
tests/unit/type/list-2.tcl
tests/unit/type/list-3.tcl [new file with mode: 0644]

index a46530921e2599b9aa3a2fa6880f5a6f05a2da86..8629fa57ca9c14ffa4940b35ea904c0eeb389df3 100644 (file)
@@ -16,6 +16,7 @@ set ::all_tests {
     unit/basic
     unit/type/list
     unit/type/list-2
+    unit/type/list-3
     unit/type/set
     unit/type/zset
     unit/type/hash
index 273ab7e74ef965378418404e03bdc2ec5f9806c0..bf6a055ebaf919ae10177de74724b7c9884061d4 100644 (file)
@@ -42,73 +42,3 @@ start_server {
         }
     }
 }
-
-start_server {
-    tags {list ziplist}
-    overrides {
-        "list-max-ziplist-value" 200000
-        "list-max-ziplist-entries" 256
-    }
-} {
-    test {Explicit regression for a list bug} {
-        set mylist {49376042582 {BkG2o\pIC]4YYJa9cJ4GWZalG[4tin;1D2whSkCOW`mX;SFXGyS8sedcff3fQI^tgPCC@^Nu1J6o]meM@Lko]t_jRyo<xSJ1oObDYd`ppZuW6P@fS278YaOx=s6lvdFlMbP0[SbkI^Kr\HBXtuFaA^mDx:yzS4a[skiiPWhT<nNfAf=aQVfclcuwDrfe;iVuKdNvB9kbfq>tK?tH[\EvWqS]b`o2OCtjg:?nUTwdjpcUm]y:pg5q24q7LlCOwQE^}}
-        r del l
-        r rpush l [lindex $mylist 0]
-        r rpush l [lindex $mylist 1]
-        assert_equal [r lindex l 0] [lindex $mylist 0]
-        assert_equal [r lindex l 1] [lindex $mylist 1]
-    }
-
-    tags {slow} {
-        test {ziplist implementation: value encoding and backlink} {
-            for {set j 0} {$j < 100} {incr j} {
-                r del l
-                set l {}
-                for {set i 0} {$i < 200} {incr i} {
-                    randpath {
-                        set data [string repeat x [randomInt 100000]]
-                    } {
-                        set data [randomInt 65536]
-                    } {
-                        set data [randomInt 4294967296]
-                    } {
-                        set data [randomInt 18446744073709551616]
-                    }
-                    lappend l $data
-                    r rpush l $data
-                }
-                assert_equal [llength $l] [r llen l]
-                # Traverse backward
-                for {set i 199} {$i >= 0} {incr i -1} {
-                    if {[lindex $l $i] ne [r lindex l $i]} {
-                        assert_equal [lindex $l $i] [r lindex l $i]
-                    }
-                }
-            }
-        }
-
-        test {ziplist implementation: encoding stress testing} {
-            for {set j 0} {$j < 200} {incr j} {
-                r del l
-                set l {}
-                set len [randomInt 400]
-                for {set i 0} {$i < $len} {incr i} {
-                    set rv [randomValue]
-                    randpath {
-                        lappend l $rv
-                        r rpush l $rv
-                    } {
-                        set l [concat [list $rv] $l]
-                        r lpush l $rv
-                    }
-                }
-                assert_equal [llength $l] [r llen l]
-                for {set i 0} {$i < 200} {incr i} {
-                    if {[lindex $l $i] ne [r lindex l $i]} {
-                        assert_equal [lindex $l $i] [r lindex l $i]
-                    }
-                }
-            }
-        }
-    }
-}
diff --git a/tests/unit/type/list-3.tcl b/tests/unit/type/list-3.tcl
new file mode 100644 (file)
index 0000000..8fdb226
--- /dev/null
@@ -0,0 +1,69 @@
+start_server {
+    tags {list ziplist}
+    overrides {
+        "list-max-ziplist-value" 200000
+        "list-max-ziplist-entries" 256
+    }
+} {
+    test {Explicit regression for a list bug} {
+        set mylist {49376042582 {BkG2o\pIC]4YYJa9cJ4GWZalG[4tin;1D2whSkCOW`mX;SFXGyS8sedcff3fQI^tgPCC@^Nu1J6o]meM@Lko]t_jRyo<xSJ1oObDYd`ppZuW6P@fS278YaOx=s6lvdFlMbP0[SbkI^Kr\HBXtuFaA^mDx:yzS4a[skiiPWhT<nNfAf=aQVfclcuwDrfe;iVuKdNvB9kbfq>tK?tH[\EvWqS]b`o2OCtjg:?nUTwdjpcUm]y:pg5q24q7LlCOwQE^}}
+        r del l
+        r rpush l [lindex $mylist 0]
+        r rpush l [lindex $mylist 1]
+        assert_equal [r lindex l 0] [lindex $mylist 0]
+        assert_equal [r lindex l 1] [lindex $mylist 1]
+    }
+
+    tags {slow} {
+        test {ziplist implementation: value encoding and backlink} {
+            for {set j 0} {$j < 100} {incr j} {
+                r del l
+                set l {}
+                for {set i 0} {$i < 200} {incr i} {
+                    randpath {
+                        set data [string repeat x [randomInt 100000]]
+                    } {
+                        set data [randomInt 65536]
+                    } {
+                        set data [randomInt 4294967296]
+                    } {
+                        set data [randomInt 18446744073709551616]
+                    }
+                    lappend l $data
+                    r rpush l $data
+                }
+                assert_equal [llength $l] [r llen l]
+                # Traverse backward
+                for {set i 199} {$i >= 0} {incr i -1} {
+                    if {[lindex $l $i] ne [r lindex l $i]} {
+                        assert_equal [lindex $l $i] [r lindex l $i]
+                    }
+                }
+            }
+        }
+
+        test {ziplist implementation: encoding stress testing} {
+            for {set j 0} {$j < 200} {incr j} {
+                r del l
+                set l {}
+                set len [randomInt 400]
+                for {set i 0} {$i < $len} {incr i} {
+                    set rv [randomValue]
+                    randpath {
+                        lappend l $rv
+                        r rpush l $rv
+                    } {
+                        set l [concat [list $rv] $l]
+                        r lpush l $rv
+                    }
+                }
+                assert_equal [llength $l] [r llen l]
+                for {set i 0} {$i < 200} {incr i} {
+                    if {[lindex $l $i] ne [r lindex l $i]} {
+                        assert_equal [lindex $l $i] [r lindex l $i]
+                    }
+                }
+            }
+        }
+    }
+}