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