summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2013-10-30 11:34:01 +0100
committerantirez <antirez@gmail.com>2013-10-30 11:34:01 +0100
commita881827b6ed3db807fb0d4a7f60765d34600aec2 (patch)
tree7793d5c98d9a0d7ac674afcb17e994f338ee7f8c
parent3c7a0677b0f226ba09c9c68c6902b9cca864088d (diff)
downloadredis-a881827b6ed3db807fb0d4a7f60765d34600aec2.tar.gz
SCAN: tests moved to unit/scan.tcl.
-rw-r--r--tests/test_helper.tcl1
-rw-r--r--tests/unit/basic.tcl54
-rw-r--r--tests/unit/scan.tcl55
3 files changed, 56 insertions, 54 deletions
diff --git a/tests/test_helper.tcl b/tests/test_helper.tcl
index d8de34e18..058ea0c09 100644
--- a/tests/test_helper.tcl
+++ b/tests/test_helper.tcl
@@ -17,6 +17,7 @@ set ::all_tests {
unit/auth
unit/protocol
unit/basic
+ unit/scan
unit/type/list
unit/type/list-2
unit/type/list-3
diff --git a/tests/unit/basic.tcl b/tests/unit/basic.tcl
index 67651666e..1f46ba666 100644
--- a/tests/unit/basic.tcl
+++ b/tests/unit/basic.tcl
@@ -761,58 +761,4 @@ start_server {tags {"basic"}} {
r keys *
r keys *
} {dlskeriewrioeuwqoirueioqwrueoqwrueqw}
-
- test "SCAN basic" {
- r flushdb
- r debug populate 1000
-
- set cur 0
- set keys {}
- while 1 {
- set res [r scan $cur]
- set cur [lindex $res 0]
- set k [lindex $res 1]
- lappend keys $k
- if {$cur == 0} break
- }
-
- set keys [lsort -unique [concat {*}$keys]]
- assert_equal 1000 [llength $keys]
- }
-
- test "SCAN COUNT" {
- r flushdb
- r debug populate 1000
-
- set cur 0
- set keys {}
- while 1 {
- set res [r scan $cur count 5]
- set cur [lindex $res 0]
- set k [lindex $res 1]
- lappend keys $k
- if {$cur == 0} break
- }
-
- set keys [lsort -unique [concat {*}$keys]]
- assert_equal 1000 [llength $keys]
- }
-
- test "SCAN MATCH" {
- r flushdb
- r debug populate 1000
-
- set cur 0
- set keys {}
- while 1 {
- set res [r scan $cur match "key:1??"]
- set cur [lindex $res 0]
- set k [lindex $res 1]
- lappend keys $k
- if {$cur == 0} break
- }
-
- set keys [lsort -unique [concat {*}$keys]]
- assert_equal 100 [llength $keys]
- }
}
diff --git a/tests/unit/scan.tcl b/tests/unit/scan.tcl
new file mode 100644
index 000000000..275a4d656
--- /dev/null
+++ b/tests/unit/scan.tcl
@@ -0,0 +1,55 @@
+start_server {tags {"scan"}} {
+ test "SCAN basic" {
+ r flushdb
+ r debug populate 1000
+
+ set cur 0
+ set keys {}
+ while 1 {
+ set res [r scan $cur]
+ set cur [lindex $res 0]
+ set k [lindex $res 1]
+ lappend keys $k
+ if {$cur == 0} break
+ }
+
+ set keys [lsort -unique [concat {*}$keys]]
+ assert_equal 1000 [llength $keys]
+ }
+
+ test "SCAN COUNT" {
+ r flushdb
+ r debug populate 1000
+
+ set cur 0
+ set keys {}
+ while 1 {
+ set res [r scan $cur count 5]
+ set cur [lindex $res 0]
+ set k [lindex $res 1]
+ lappend keys $k
+ if {$cur == 0} break
+ }
+
+ set keys [lsort -unique [concat {*}$keys]]
+ assert_equal 1000 [llength $keys]
+ }
+
+ test "SCAN MATCH" {
+ r flushdb
+ r debug populate 1000
+
+ set cur 0
+ set keys {}
+ while 1 {
+ set res [r scan $cur match "key:1??"]
+ set cur [lindex $res 0]
+ set k [lindex $res 1]
+ lappend keys $k
+ if {$cur == 0} break
+ }
+
+ set keys [lsort -unique [concat {*}$keys]]
+ assert_equal 100 [llength $keys]
+ }
+}