X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/0681c5ad844cefefbe62f30df6587c0cbec3272e..9bd0e097aa19b697757cdb73dd447e2c6f4960c6:/tests/unit/type/zset.tcl diff --git a/tests/unit/type/zset.tcl b/tests/unit/type/zset.tcl index 41f5f588..806f4c88 100644 --- a/tests/unit/type/zset.tcl +++ b/tests/unit/type/zset.tcl @@ -36,11 +36,11 @@ start_server {tags {"zset"}} { } test "ZSET element can't be set to NaN with ZADD - $encoding" { - assert_error "*not a double*" {r zadd myzset nan abc} + assert_error "*not*float*" {r zadd myzset nan abc} } test "ZSET element can't be set to NaN with ZINCRBY" { - assert_error "*not a double*" {r zadd myzset nan abc} + assert_error "*not*float*" {r zadd myzset nan abc} } test "ZINCRBY calls leading to NaN result in error" { @@ -60,7 +60,7 @@ start_server {tags {"zset"}} { test {ZADD - Variadic version does not add nothing on single parsing err} { r del myzset catch {r zadd myzset 10 a 20 b 30.badscore c} e - assert_match {*ERR*not*double*} $e + assert_match {*ERR*not*float*} $e r exists myzset } {0} @@ -291,9 +291,9 @@ start_server {tags {"zset"}} { } 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} + assert_error "*not*float*" {r zrangebyscore fooz str 1} + assert_error "*not*float*" {r zrangebyscore fooz 1 str} + assert_error "*not*float*" {r zrangebyscore fooz 1 NaN} } test "ZREMRANGEBYSCORE basics" { @@ -353,9 +353,9 @@ start_server {tags {"zset"}} { } 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} + assert_error "*not*float*" {r zremrangebyscore fooz str 1} + assert_error "*not*float*" {r zremrangebyscore fooz 1 str} + assert_error "*not*float*" {r zremrangebyscore fooz 1 NaN} } test "ZREMRANGEBYRANK basics" { @@ -501,7 +501,7 @@ start_server {tags {"zset"}} { r zadd zsetinf1 1.0 key r zadd zsetinf2 1.0 key - assert_error "*weight value is not a double*" { + assert_error "*weight*not*float*" { r $cmd zsetinf3 2 zsetinf1 zsetinf2 weights nan nan } } @@ -518,6 +518,20 @@ start_server {tags {"zset"}} { r zinterstore set3 2 set1 set2 } {0} + test {ZUNIONSTORE regression, should not create NaN in scores} { + r zadd z -inf neginf + r zunionstore out 1 z weights 0 + r zrange out 0 -1 withscores + } {neginf 0} + + test {ZINTERSTORE #516 regression, mixed sets and ziplist zsets} { + r sadd one 100 101 102 103 + r sadd two 100 200 201 202 + r zadd three 1 500 1 501 1 502 1 503 1 100 + r zinterstore to_here 3 one two three WEIGHTS 0 0 1 + r zrange to_here 0 -1 + } {100} + proc stressers {encoding} { if {$encoding == "ziplist"} { # Little extra to allow proper fuzzing in the sorting stresser