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