diff options
author | Evan Miller <emiller@imvu.com> | 2007-08-22 04:03:01 +0000 |
---|---|---|
committer | Evan Miller <emiller@imvu.com> | 2007-08-22 04:03:01 +0000 |
commit | b95946f45b9692aaeac2db70b69647c692a86f83 (patch) | |
tree | 1845172f0827557f1e1499d93113b05e2c732c3a /t/incrdecr.t | |
parent | 9d99ab666da9ef495dca289a0854f9a624c07e64 (diff) | |
download | memcached-b95946f45b9692aaeac2db70b69647c692a86f83.tar.gz |
Incorporate incrememnt patch from Evan Miller
<emiller@imvu.com> to define increment overflow behavior.
git-svn-id: http://code.sixapart.com/svn/memcached/trunk/server@608 b0b603af-a30f-0410-a34e-baf09ae79d0b
Diffstat (limited to 't/incrdecr.t')
-rwxr-xr-x | t/incrdecr.t | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/t/incrdecr.t b/t/incrdecr.t index 4abd691..6849630 100755 --- a/t/incrdecr.t +++ b/t/incrdecr.t @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; -use Test::More tests => 13; +use Test::More tests => 16; use FindBin qw($Bin); use lib "$Bin/lib"; use MemcachedTest; @@ -30,6 +30,15 @@ is(scalar <$sock>, "0\r\n", "- 9 = 0"); print $sock "decr num 5\r\n"; is(scalar <$sock>, "0\r\n", "- 5 = 0"); +print $sock "incr num ".(2**32-2)."\r\n"; +is(scalar <$sock>, (2**32-2)."\r\n", "+ ".(2**32-2)." = ".(2**32-2)); + +print $sock "incr num 1\r\n"; +is(scalar <$sock>, (2**32-1)."\r\n", "+ 1 = ".(2**32-1)); + +print $sock "incr num 1\r\n"; +is(scalar <$sock>, "0\r\n", "+ 1 = 0"); + print $sock "decr bogus 5\r\n"; is(scalar <$sock>, "NOT_FOUND\r\n", "can't decr bogus key"); @@ -40,5 +49,3 @@ print $sock "set text 0 0 2\r\nhi\r\n"; is(scalar <$sock>, "STORED\r\n", "stored text"); print $sock "incr text 1\r\n"; is(scalar <$sock>, "1\r\n", "hi - 1 = 0"); - - |