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