mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 03:33:28 +00:00
more valgrind (and other archs) friendly testing of floating number related features.
This commit is contained in:
parent
cd4aba36cd
commit
bf758397a1
@ -294,3 +294,7 @@ proc csvdump r {
|
||||
proc csvstring s {
|
||||
return "\"$s\""
|
||||
}
|
||||
|
||||
proc roundFloat f {
|
||||
format "%.10g" $f
|
||||
}
|
||||
|
@ -152,13 +152,15 @@ start_server {tags {"basic"}} {
|
||||
|
||||
test {INCRBYFLOAT against non existing key} {
|
||||
r del novar
|
||||
list [r incrbyfloat novar 1] [r get novar] [r incrbyfloat novar 0.25] \
|
||||
[r get novar]
|
||||
list [roundFloat [r incrbyfloat novar 1]] \
|
||||
[roundFloat [r get novar]] \
|
||||
[roundFloat [r incrbyfloat novar 0.25]] \
|
||||
[roundFloat [r get novar]]
|
||||
} {1 1 1.25 1.25}
|
||||
|
||||
test {INCRBYFLOAT against key originally set with SET} {
|
||||
r set novar 1.5
|
||||
r incrbyfloat novar 1.5
|
||||
roundFloat [r incrbyfloat novar 1.5]
|
||||
} {3}
|
||||
|
||||
test {INCRBYFLOAT over 32bit value} {
|
||||
@ -213,7 +215,7 @@ start_server {tags {"basic"}} {
|
||||
|
||||
test {INCRBYFLOAT decrement} {
|
||||
r set foo 1
|
||||
r incrbyfloat foo -1.1
|
||||
roundFloat [r incrbyfloat foo -1.1]
|
||||
} {-0.1}
|
||||
|
||||
test "SETNX target key missing" {
|
||||
|
@ -327,30 +327,32 @@ start_server {tags {"hash"}} {
|
||||
set rv {}
|
||||
r hdel smallhash tmp
|
||||
r hdel bighash tmp
|
||||
lappend rv [r hincrbyfloat smallhash tmp 2.5]
|
||||
lappend rv [r hget smallhash tmp]
|
||||
lappend rv [r hincrbyfloat bighash tmp 2.5]
|
||||
lappend rv [r hget bighash tmp]
|
||||
lappend rv [roundFloat [r hincrbyfloat smallhash tmp 2.5]]
|
||||
lappend rv [roundFloat [r hget smallhash tmp]]
|
||||
lappend rv [roundFloat [r hincrbyfloat bighash tmp 2.5]]
|
||||
lappend rv [roundFloat [r hget bighash tmp]]
|
||||
} {2.5 2.5 2.5 2.5}
|
||||
|
||||
test {HINCRBYFLOAT against hash key created by hincrby itself} {
|
||||
set rv {}
|
||||
lappend rv [r hincrbyfloat smallhash tmp 3.5]
|
||||
lappend rv [r hget smallhash tmp]
|
||||
lappend rv [r hincrbyfloat bighash tmp 3.5]
|
||||
lappend rv [r hget bighash tmp]
|
||||
lappend rv [roundFloat [r hincrbyfloat smallhash tmp 3.5]]
|
||||
lappend rv [roundFloat [r hget smallhash tmp]]
|
||||
lappend rv [roundFloat [r hincrbyfloat bighash tmp 3.5]]
|
||||
lappend rv [roundFloat [r hget bighash tmp]]
|
||||
} {6 6 6 6}
|
||||
|
||||
test {HINCRBYFLOAT against hash key originally set with HSET} {
|
||||
r hset smallhash tmp 100
|
||||
r hset bighash tmp 100
|
||||
list [r hincrbyfloat smallhash tmp 2.5] [r hincrbyfloat bighash tmp 2.5]
|
||||
list [roundFloat [r hincrbyfloat smallhash tmp 2.5]] \
|
||||
[roundFloat [r hincrbyfloat bighash tmp 2.5]]
|
||||
} {102.5 102.5}
|
||||
|
||||
test {HINCRBYFLOAT over 32bit value} {
|
||||
r hset smallhash tmp 17179869184
|
||||
r hset bighash tmp 17179869184
|
||||
list [r hincrbyfloat smallhash tmp 1] [r hincrbyfloat bighash tmp 1]
|
||||
list [r hincrbyfloat smallhash tmp 1] \
|
||||
[r hincrbyfloat bighash tmp 1]
|
||||
} {17179869185 17179869185}
|
||||
|
||||
test {HINCRBYFLOAT over 32bit value with over 32bit increment} {
|
||||
|
Loading…
Reference in New Issue
Block a user