Skip to content

Commit 83d5f30

Browse files
authoredFeb 10, 2017
Separate test for 64-bit increment/decrement/incrementByKey/decrementByKey (#321)
1 parent ecd77ab commit 83d5f30

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed
 

Diff for: ‎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'/>

Diff for: ‎tests/incrdecr_64.phpt

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

0 commit comments

Comments
 (0)
Please sign in to comment.