xref: /PHP-5.4/ext/gmp/tests/018.phpt (revision eb5bd09c)
1--TEST--
2gmp_sqrtrem() basic tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8$r = gmp_sqrtrem(-1);
9var_dump(gmp_strval($r[0]));
10var_dump(gmp_strval($r[1]));
11
12$r = gmp_sqrtrem("0");
13var_dump(gmp_strval($r[0]));
14var_dump(gmp_strval($r[1]));
15
16$r = gmp_sqrtrem(2);
17var_dump(gmp_strval($r[0]));
18var_dump(gmp_strval($r[1]));
19
20$r = gmp_sqrtrem(10);
21var_dump(gmp_strval($r[0]));
22var_dump(gmp_strval($r[1]));
23
24$r = gmp_sqrtrem(7);
25var_dump(gmp_strval($r[0]));
26var_dump(gmp_strval($r[1]));
27
28$r = gmp_sqrtrem(3);
29var_dump(gmp_strval($r[0]));
30var_dump(gmp_strval($r[1]));
31
32$r = gmp_sqrtrem(100000);
33var_dump(gmp_strval($r[0]));
34var_dump(gmp_strval($r[1]));
35
36$r = gmp_sqrtrem("1000000");
37var_dump(gmp_strval($r[0]));
38var_dump(gmp_strval($r[1]));
39
40$r = gmp_sqrtrem("1000001");
41var_dump(gmp_strval($r[0]));
42var_dump(gmp_strval($r[1]));
43
44
45$n = gmp_init(-1);
46$r = gmp_sqrtrem($n);
47var_dump(gmp_strval($r[0]));
48var_dump(gmp_strval($r[1]));
49
50$n = gmp_init(1000001);
51$r = gmp_sqrtrem($n);
52var_dump(gmp_strval($r[0]));
53var_dump(gmp_strval($r[1]));
54
55var_dump(gmp_sqrtrem(array()));
56var_dump(gmp_sqrtrem());
57
58echo "Done\n";
59?>
60--EXPECTF--
61Warning: gmp_sqrtrem(): Number has to be greater than or equal to 0 in %s on line %d
62
63Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
64bool(false)
65
66Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
67bool(false)
68string(1) "0"
69string(1) "0"
70string(1) "1"
71string(1) "1"
72string(1) "3"
73string(1) "1"
74string(1) "2"
75string(1) "3"
76string(1) "1"
77string(1) "2"
78string(3) "316"
79string(3) "144"
80string(4) "1000"
81string(1) "0"
82string(4) "1000"
83string(1) "1"
84
85Warning: gmp_sqrtrem(): Number has to be greater than or equal to 0 in %s on line %d
86
87Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
88bool(false)
89
90Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
91bool(false)
92string(4) "1000"
93string(1) "1"
94
95Warning: gmp_sqrtrem(): Unable to convert variable to GMP - wrong type in %s on line %d
96bool(false)
97
98Warning: gmp_sqrtrem() expects exactly 1 parameter, 0 given in %s on line %d
99NULL
100Done
101