Skip to content

Commit 7a930e9

Browse files
committed
Separate test for 64-bit increment/decremenet/incrementByKey/decrementByKey
1 parent ecd77ab commit 7a930e9

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

package.xml

+2
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Fixes
7474
<file role='src' name='fastlz/fastlz.c'/>
7575
<file role='src' name='fastlz/fastlz.h'/>
7676
<dir name="tests">
77+
<file role='test' name='skipif.inc'/>
7778
<file role='test' name='001.phpt'/>
7879
<file role='test' name='version.phpt'/>
7980
<file role='test' name='bug_16084.phpt'/>
@@ -143,6 +144,7 @@ Fixes
143144
<file role='test' name='setmulti.phpt'/>
144145
<file role='test' name='cachecallback.phpt'/>
145146
<file role='test' name='incrdecr.phpt'/>
147+
<file role='test' name='incrdecr_64.phpt'/>
146148
<file role='test' name='incrdecr_initial.phpt'/>
147149
<file role='test' name='incrdecr_invalid_key.phpt'/>
148150
<file role='test' name='incrdecr_bykey.phpt'/>

tests/incrdecr_64.phpt

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
--TEST--
2+
64-bit Memcached::increment() decrement() incrementByKey() decrementByKey()
3+
--SKIPIF--
4+
<?php include "skipif.inc";
5+
if (PHP_INT_SIZE < 8) {
6+
die("This PHP does not support 64-bit integers");
7+
}
8+
?>
9+
--FILE--
10+
<?php
11+
include dirname (__FILE__) . '/config.inc';
12+
$m = memc_get_instance ();
13+
14+
echo "Normal\n";
15+
$m->set('foo', 1);
16+
var_dump($m->get('foo'));
17+
18+
echo "Enormous offset 64-bit\n";
19+
$m->increment('foo', 0x100000000);
20+
var_dump($m->get('foo'));
21+
22+
$m->decrement('foo', 0x100000000);
23+
var_dump($m->get('foo'));
24+
25+
echo "Enormous offset 64-bit by key\n";
26+
$m->incrementByKey('foo', 'foo', 0x100000000);
27+
var_dump($m->get('foo'));
28+
29+
$m->decrementByKey('foo', 'foo', 0x100000000);
30+
var_dump($m->get('foo'));
31+
32+
--EXPECT--
33+
Normal
34+
int(1)
35+
Enormous offset 64-bit
36+
int(4294967297)
37+
int(1)
38+
Enormous offset 64-bit by key
39+
int(4294967297)
40+
int(1)

0 commit comments

Comments
 (0)