]> git.saurik.com Git - redis.git/blobdiff - tests/unit/type/zset.tcl
Return error when min and/or max in the sorted set range spec is not a double
[redis.git] / tests / unit / type / zset.tcl
index 47c056073bcce9e9d2171b089f091619c6c9f1fe..6b8fc54ae3af6232ae6f850bdec30893fb718f6c 100644 (file)
@@ -253,6 +253,12 @@ start_server {tags {"zset"}} {
         assert_equal {d 3 c 2} [r zrevrangebyscore zset 5 2 LIMIT 2 3 WITHSCORES]
     }
 
+    test "ZRANGEBYSCORE with non-value min or max" {
+        assert_error "*not a double*" {r zrangebyscore fooz str 1}
+        assert_error "*not a double*" {r zrangebyscore fooz 1 str}
+        assert_error "*not a double*" {r zrangebyscore fooz 1 NaN}
+    }
+
     tags {"slow"} {
         test {ZRANGEBYSCORE fuzzy test, 100 ranges in 1000 elements sorted set} {
             set err {}
@@ -386,6 +392,12 @@ start_server {tags {"zset"}} {
         assert_equal {a e} [r zrange zset 0 -1]
     }
 
+    test "ZREMRANGEBYSCORE with non-value min or max" {
+        assert_error "*not a double*" {r zremrangebyscore fooz str 1}
+        assert_error "*not a double*" {r zremrangebyscore fooz 1 str}
+        assert_error "*not a double*" {r zremrangebyscore fooz 1 NaN}
+    }
+
     test "ZREMRANGEBYRANK basics" {
         proc remrangebyrank {min max} {
             create_zset zset {1 a 2 b 3 c 4 d 5 e}