xref: /PHP-5.6/ext/gmp/tests/gmp_root.phpt (revision 03797a73)
1--TEST--
2gmp_root() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_root());
9
10var_dump(gmp_root(1000, 3));
11var_dump(gmp_root(100, 3));
12var_dump(gmp_root(-100, 3));
13
14var_dump(gmp_root(1000, 4));
15var_dump(gmp_root(100, 4));
16var_dump(gmp_root(-100, 4));
17
18var_dump(gmp_root(0, 3));
19var_dump(gmp_root(100, 0));
20var_dump(gmp_root(100, -3));
21
22?>
23--EXPECTF--
24Warning: gmp_root() expects exactly 2 parameters, 0 given in %s on line %d
25NULL
26object(GMP)#%d (1) {
27  ["num"]=>
28  string(2) "10"
29}
30object(GMP)#%d (1) {
31  ["num"]=>
32  string(1) "4"
33}
34object(GMP)#%d (1) {
35  ["num"]=>
36  string(2) "-4"
37}
38object(GMP)#%d (1) {
39  ["num"]=>
40  string(1) "5"
41}
42object(GMP)#%d (1) {
43  ["num"]=>
44  string(1) "3"
45}
46
47Warning: gmp_root(): Can't take even root of negative number in %s on line %d
48bool(false)
49object(GMP)#%d (1) {
50  ["num"]=>
51  string(1) "0"
52}
53
54Warning: gmp_root(): The root must be positive in %s on line %d
55bool(false)
56
57Warning: gmp_root(): The root must be positive in %s on line %d
58bool(false)
59