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