summaryrefslogtreecommitdiffstats
path: root/incrdecr_64.phpt
blob: d71c050d894b6aee1e7b1552a40c522839246fb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
--TEST--
Memcached::increment() Memcached::decrement() on 64bits
--SKIPIF--
<?php
include "skipif.inc";
if (PHP_INT_SIZE < 8) die("skip valid for 64-bit only");
?>
--FILE--
<?php
include dirname (__FILE__) . '/config.inc';
$m = memc_get_instance ();

echo "Not there\n";
$m->delete('foo');
var_dump($m->increment('foo', 1));
var_dump($m->getResultCode());
var_dump($m->decrement('foo', 1));
var_dump($m->getResultCode());
var_dump($m->get('foo'));
var_dump($m->getResultCode());

echo "Normal\n";
$m->set('foo', 1);
var_dump($m->get('foo'));
$m->increment('foo');
var_dump($m->get('foo'));
$m->increment('foo', 2);
var_dump($m->get('foo'));
$m->decrement('foo');
var_dump($m->get('foo'));
$m->decrement('foo', 2);
var_dump($m->get('foo'));

error_reporting(0);

echo "Negative offset\n";
$php_errormsg = '';
$m->increment('foo', -1);
echo $php_errormsg, "\n";
var_dump($m->get('foo'));

$php_errormsg = '';
$m->decrement('foo', -1);
echo $php_errormsg, "\n";
var_dump($m->get('foo'));

echo "Enormous offset\n";
$m->increment('foo', 4294967296);
var_dump($m->get('foo'));

$m->decrement('foo', 4294967296);
var_dump($m->get('foo'));

--EXPECT--
Not there
bool(false)
int(16)
bool(false)
int(16)
bool(false)
int(16)
Normal
int(1)
int(2)
int(4)
int(3)
int(1)
Negative offset
Memcached::increment(): offset cannot be a negative value
int(1)
Memcached::decrement(): offset cannot be a negative value
int(1)
Enormous offset
int(4294967297)
int(1)