xref: /PHP-5.6/ext/gmp/tests/gmp_sub.phpt (revision 9586b152)
1--TEST--
2gmp_sub() tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_sub());
9var_dump(gmp_sub(""));
10var_dump(gmp_sub("", ""));
11var_dump(gmp_sub("", "", ""));
12var_dump(gmp_sub(array(), array()));
13
14var_dump($g = gmp_sub(10000, 10001));
15var_dump(gmp_strval($g));
16var_dump($g = gmp_sub(10000, -1));
17var_dump(gmp_strval($g));
18var_dump($g = gmp_sub(10000, new stdclass));
19var_dump(gmp_strval($g));
20var_dump($g = gmp_sub(new stdclass, 100));
21var_dump(gmp_strval($g));
22
23echo "Done\n";
24?>
25--EXPECTF--
26Warning: gmp_sub() expects exactly 2 parameters, 0 given in %s on line %d
27NULL
28
29Warning: gmp_sub() expects exactly 2 parameters, 1 given in %s on line %d
30NULL
31
32Warning: gmp_sub(): Unable to convert variable to GMP - string is not an integer in %s on line %d
33bool(false)
34
35Warning: gmp_sub() expects exactly 2 parameters, 3 given in %s on line %d
36NULL
37
38Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
39bool(false)
40object(GMP)#%d (1) {
41  ["num"]=>
42  string(2) "-1"
43}
44string(2) "-1"
45object(GMP)#%d (1) {
46  ["num"]=>
47  string(5) "10001"
48}
49string(5) "10001"
50
51Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
52bool(false)
53string(1) "0"
54
55Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d
56bool(false)
57string(1) "0"
58Done
59