xref: /PHP-7.2/ext/gmp/tests/gmp_invert.phpt (revision 17ccbeec)
1--TEST--
2gmp_invert() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_strval(gmp_invert(123123,5467624)));
9var_dump(gmp_strval(gmp_invert(123123,"3333334345467624")));
10var_dump(gmp_strval(gmp_invert("12312323213123123",7624)));
11var_dump(gmp_strval(gmp_invert(444,0)));
12var_dump(gmp_strval(gmp_invert(0,28347)));
13var_dump(gmp_strval(gmp_invert(-12,456456)));
14var_dump(gmp_strval(gmp_invert(234234,-435345)));
15
16$n = gmp_init("349827349623423452345");
17$n1 = gmp_init("3498273496234234523451");
18
19var_dump(gmp_strval(gmp_invert($n, $n1)));
20var_dump(gmp_strval(gmp_invert($n1, $n)));
21
22var_dump(gmp_invert($n1, $n, 10));
23var_dump(gmp_invert($n1));
24var_dump(gmp_invert(array(), 1));
25var_dump(gmp_invert(1, array()));
26var_dump(gmp_invert(array(), array()));
27
28echo "Done\n";
29?>
30--EXPECTF--
31string(7) "2293131"
32string(1) "0"
33string(4) "5827"
34string(1) "0"
35string(1) "0"
36string(1) "0"
37string(1) "0"
38string(22) "3498273496234234523441"
39string(1) "1"
40
41Warning: gmp_invert() expects exactly 2 parameters, 3 given in %s on line %d
42NULL
43
44Warning: gmp_invert() expects exactly 2 parameters, 1 given in %s on line %d
45NULL
46
47Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
48bool(false)
49
50Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
51bool(false)
52
53Warning: gmp_invert(): Unable to convert variable to GMP - wrong type in %s on line %d
54bool(false)
55Done
56