summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--TODO4
-rw-r--r--redis.c4
-rw-r--r--test-redis.tcl17
4 files changed, 22 insertions, 6 deletions
diff --git a/.gitignore b/.gitignore
index 56c27fdd6..a9bd59efd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+00-RELEASENOTES
*.o
*.rdb
+*.log
redis-cli
redis-server
redis-benchmark
@@ -7,3 +9,4 @@ doc-tools
mkrelease.sh
release
myredis.conf
+misc/*
diff --git a/TODO b/TODO
index dfd75093a..ec5c636c4 100644
--- a/TODO
+++ b/TODO
@@ -6,8 +6,8 @@ VERSION 1.1 TODO
* Add all the missing symbols for the static functions into the table. Crete a Tcl script to check this. This backtrace on segfault is indeed *very* useful.
* Use strcoll() to compare objects in sorted sets, like it already happens for SORT.
* LMOVE, as discussed in the Redis group.
-* EXPIRE and EXPIREAT tests.
-* Write docs for the "STORE" operaiton of SORT.
+* EXPIRE, EXPIREAT, ZSCORE tests.
+* Write docs for the "STORE" operaiton of SORT, and GET "#" option.
* Append only mode: testing and a command to rebuild the log from scratch.
VERSION 1.2 TODO
diff --git a/redis.c b/redis.c
index f5fb5e455..e0e93aadd 100644
--- a/redis.c
+++ b/redis.c
@@ -2331,7 +2331,7 @@ static int rdbSaveDoubleValue(FILE *fp, double val) {
len = 1;
buf[0] = (val < 0) ? 255 : 254;
} else {
- snprintf((char*)buf+1,sizeof(buf)-1,"%.16g",val);
+ snprintf((char*)buf+1,sizeof(buf)-1,"%.17g",val);
buf[0] = strlen((char*)buf);
len = buf[0]+1;
}
@@ -4307,7 +4307,7 @@ static void zscoreCommand(redisClient *c) {
char buf[128];
double *score = dictGetEntryVal(de);
- snprintf(buf,sizeof(buf),"%.16g",*score);
+ snprintf(buf,sizeof(buf),"%.17g",*score);
addReplySds(c,sdscatprintf(sdsempty(),"$%d\r\n%s\r\n",
strlen(buf),buf));
}
diff --git a/test-redis.tcl b/test-redis.tcl
index a6e36db43..266d5fb9d 100644
--- a/test-redis.tcl
+++ b/test-redis.tcl
@@ -789,8 +789,21 @@ proc main {server port} {
} {{x y z} {y x z}}
test {ZSCORE} {
- list [$r zscore ztmp x] [$r zscore ztmp y] [$r zscore ztmp z]
- } {10 1 30}
+ set aux {}
+ set err {}
+ for {set i 0} {$i < 1000} {incr i} {
+ set score [expr rand()]
+ lappend aux $score
+ $r zadd zscoretest $score $i
+ }
+ for {set i 0} {$i < 1000} {incr i} {
+ if {[$r zscore zscoretest $i] != [lindex $aux $i]} {
+ set err "Expected score was [lindex $aux $i] but got [$r zscore zscoretest $i] for element $i"
+ break
+ }
+ }
+ set _ $err
+ } {}
test {ZRANGE and ZREVRANGE} {
list [$r zrange ztmp 0 -1] [$r zrevrange ztmp 0 -1]