1--TEST--
2gmp_perfect_square() basic tests
3--EXTENSIONS--
4gmp
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
24try {
25    var_dump(gmp_perfect_square(array()));
26} catch (\TypeError $e) {
27    echo $e->getMessage() . \PHP_EOL;
28}
29
30echo "Done\n";
31?>
32--EXPECT--
33bool(true)
34bool(true)
35bool(false)
36bool(true)
37bool(true)
38bool(false)
39bool(true)
40bool(false)
41bool(false)
42bool(true)
43bool(false)
44gmp_perfect_square(): Argument #1 ($num) must be of type GMP|string|int, array given
45Done
46