list [r zunionstore zsetc 2 zseta zsetb weights 2 3] [r zrange zsetc 0 -1 withscores]
} {4 {a 2 b 7 d 9 c 12}}
+ test {ZUNIONSTORE with a regular set and weights} {
+ r del seta
+ r sadd seta a
+ r sadd seta b
+ r sadd seta c
+ list [r zunionstore zsetc 2 seta zsetb weights 2 3] [r zrange zsetc 0 -1 withscores]
+ } {4 {a 2 b 5 c 8 d 9}}
+
test {ZUNIONSTORE with AGGREGATE MIN} {
list [r zunionstore zsetc 2 zseta zsetb aggregate min] [r zrange zsetc 0 -1 withscores]
} {4 {a 1 b 1 c 2 d 3}}
list [r zinterstore zsetc 2 zseta zsetb weights 2 3] [r zrange zsetc 0 -1 withscores]
} {2 {b 7 c 12}}
+ test {ZINTERSTORE with a regular set and weights} {
+ r del seta
+ r sadd seta a
+ r sadd seta b
+ r sadd seta c
+ list [r zinterstore zsetc 2 seta zsetb weights 2 3] [r zrange zsetc 0 -1 withscores]
+ } {2 {b 5 c 8}}
+
test {ZINTERSTORE with AGGREGATE MIN} {
list [r zinterstore zsetc 2 zseta zsetb aggregate min] [r zrange zsetc 0 -1 withscores]
} {2 {b 1 c 2}}
}
set _ $err
} {}
+
+ test {ZSET element can't be set to nan with ZADD} {
+ set e {}
+ catch {r zadd myzset nan abc} e
+ set _ $e
+ } {*Not A Number*}
+
+ test {ZSET element can't be set to nan with ZINCRBY} {
+ set e {}
+ catch {r zincrby myzset nan abc} e
+ set _ $e
+ } {*Not A Number*}
+
+ test {ZINCRBY calls leading to Nan are refused} {
+ set e {}
+ r zincrby myzset +inf abc
+ catch {r zincrby myzset -inf abc} e
+ set _ $e
+ } {*Not A Number*}
}