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
cf2815b6
Commit
cf2815b6
authored
Oct 03, 2014
by
antirez
Browse files
Test: check that INCR object sharing works as expected.
parent
b9764488
Changes
1
Show whitespace changes
Inline
Side-by-side
tests/unit/basic.tcl
View file @
cf2815b6
...
...
@@ -150,6 +150,29 @@ start_server {tags {"basic"}} {
r decrby novar 17179869185
}
{
-1
}
test
{
INCR uses shared objects in the 0-9999 range
}
{
r set foo -1
r incr foo
assert
{[
r object refcount foo
]
> 1
}
r set foo 9998
r incr foo
assert
{[
r object refcount foo
]
> 1
}
r incr foo
assert
{[
r object refcount foo
]
== 1
}
}
test
{
INCR can modify objects in-place
}
{
r set foo 20000
r incr foo
assert
{[
r object refcount foo
]
== 1
}
set old
[
lindex
[
split
[
r debug object foo
]]
1
]
r incr foo
set new
[
lindex
[
split
[
r debug object foo
]]
1
]
assert
{[
string range $old 0 2
]
eq
"at:"
}
assert
{[
string range $new 0 2
]
eq
"at:"
}
assert
{
$old
eq $new
}
}
test
{
INCRBYFLOAT against non existing key
}
{
r del novar
list
[
roundFloat
[
r incrbyfloat novar 1
]]
\
...
...
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