Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
bf758397
Commit
bf758397
authored
Nov 16, 2011
by
antirez
Browse files
more valgrind (and other archs) friendly testing of floating number related features.
parent
cd4aba36
Changes
3
Show whitespace changes
Inline
Side-by-side
tests/support/util.tcl
View file @
bf758397
...
@@ -294,3 +294,7 @@ proc csvdump r {
...
@@ -294,3 +294,7 @@ proc csvdump r {
proc csvstring s
{
proc csvstring s
{
return
"
\"
$s
\"
"
return
"
\"
$s
\"
"
}
}
proc roundFloat f
{
format
"%.10g"
$f
}
tests/unit/basic.tcl
View file @
bf758397
...
@@ -152,13 +152,15 @@ start_server {tags {"basic"}} {
...
@@ -152,13 +152,15 @@ start_server {tags {"basic"}} {
test
{
INCRBYFLOAT against non existing key
}
{
test
{
INCRBYFLOAT against non existing key
}
{
r del novar
r del novar
list
[
r incrbyfloat novar 1
]
[
r get novar
]
[
r incrbyfloat novar 0.25
]
\
list
[
roundFloat
[
r incrbyfloat novar 1
]]
\
[
r get novar
]
[
roundFloat
[
r get novar
]]
\
[
roundFloat
[
r incrbyfloat novar 0.25
]]
\
[
roundFloat
[
r get novar
]]
}
{
1 1 1.25 1.25
}
}
{
1 1 1.25 1.25
}
test
{
INCRBYFLOAT against key originally set with SET
}
{
test
{
INCRBYFLOAT against key originally set with SET
}
{
r set novar 1.5
r set novar 1.5
r incrbyfloat novar 1.5
roundFloat
[
r incrbyfloat novar 1.5
]
}
{
3
}
}
{
3
}
test
{
INCRBYFLOAT over 32bit value
}
{
test
{
INCRBYFLOAT over 32bit value
}
{
...
@@ -213,7 +215,7 @@ start_server {tags {"basic"}} {
...
@@ -213,7 +215,7 @@ start_server {tags {"basic"}} {
test
{
INCRBYFLOAT decrement
}
{
test
{
INCRBYFLOAT decrement
}
{
r set foo 1
r set foo 1
r incrbyfloat foo -1.1
roundFloat
[
r incrbyfloat foo -1.1
]
}
{
-0.1
}
}
{
-0.1
}
test
"SETNX target key missing"
{
test
"SETNX target key missing"
{
...
...
tests/unit/type/hash.tcl
View file @
bf758397
...
@@ -327,30 +327,32 @@ start_server {tags {"hash"}} {
...
@@ -327,30 +327,32 @@ start_server {tags {"hash"}} {
set rv
{}
set rv
{}
r hdel smallhash tmp
r hdel smallhash tmp
r hdel bighash tmp
r hdel bighash tmp
lappend rv
[
r hincrbyfloat smallhash tmp 2.5
]
lappend rv
[
roundFloat
[
r hincrbyfloat smallhash tmp 2.5
]
]
lappend rv
[
r hget smallhash tmp
]
lappend rv
[
roundFloat
[
r hget smallhash tmp
]
]
lappend rv
[
r hincrbyfloat bighash tmp 2.5
]
lappend rv
[
roundFloat
[
r hincrbyfloat bighash tmp 2.5
]
]
lappend rv
[
r hget bighash tmp
]
lappend rv
[
roundFloat
[
r hget bighash tmp
]
]
}
{
2.5 2.5 2.5 2.5
}
}
{
2.5 2.5 2.5 2.5
}
test
{
HINCRBYFLOAT against hash key created by hincrby itself
}
{
test
{
HINCRBYFLOAT against hash key created by hincrby itself
}
{
set rv
{}
set rv
{}
lappend rv
[
r hincrbyfloat smallhash tmp 3.5
]
lappend rv
[
roundFloat
[
r hincrbyfloat smallhash tmp 3.5
]
]
lappend rv
[
r hget smallhash tmp
]
lappend rv
[
roundFloat
[
r hget smallhash tmp
]
]
lappend rv
[
r hincrbyfloat bighash tmp 3.5
]
lappend rv
[
roundFloat
[
r hincrbyfloat bighash tmp 3.5
]
]
lappend rv
[
r hget bighash tmp
]
lappend rv
[
roundFloat
[
r hget bighash tmp
]
]
}
{
6 6 6 6
}
}
{
6 6 6 6
}
test
{
HINCRBYFLOAT against hash key originally set with HSET
}
{
test
{
HINCRBYFLOAT against hash key originally set with HSET
}
{
r hset smallhash tmp 100
r hset smallhash tmp 100
r hset bighash 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
}
}
{
102.5 102.5
}
test
{
HINCRBYFLOAT over 32bit value
}
{
test
{
HINCRBYFLOAT over 32bit value
}
{
r hset smallhash tmp 17179869184
r hset smallhash tmp 17179869184
r hset bighash 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
}
}
{
17179869185 17179869185
}
test
{
HINCRBYFLOAT over 32bit value with over 32bit increment
}
{
test
{
HINCRBYFLOAT over 32bit value with over 32bit increment
}
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment