xref: /PHP-5.3/ext/gmp/tests/012.phpt (revision eb5bd09c)
1--TEST--
2gmp_neg() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_intval(gmp_neg(0)));
9var_dump(gmp_intval(gmp_neg(1)));
10var_dump(gmp_intval(gmp_neg(-1)));
11var_dump(gmp_intval(gmp_neg("-1")));
12var_dump(gmp_intval(gmp_neg("")));
13var_dump(gmp_intval(gmp_neg(0)));
14
15$n = gmp_init("0");
16var_dump(gmp_intval(gmp_neg($n)));
17$n = gmp_init("12345678901234567890");
18var_dump(gmp_strval(gmp_neg($n)));
19
20var_dump(gmp_neg(1,1));
21var_dump(gmp_neg());
22var_dump(gmp_neg(array()));
23
24echo "Done\n";
25?>
26--EXPECTF--
27int(0)
28int(-1)
29int(1)
30int(1)
31int(0)
32int(0)
33int(0)
34string(21) "-12345678901234567890"
35
36Warning: gmp_neg() expects exactly 1 parameter, 2 given in %s on line %d
37NULL
38
39Warning: gmp_neg() expects exactly 1 parameter, 0 given in %s on line %d
40NULL
41
42Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d
43bool(false)
44Done
45