xref: /PHP-7.3/ext/gmp/tests/gmp_div_q.phpt (revision 782352c5)
1--TEST--
2gmp_div_q() tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_div_q());
9var_dump(gmp_div_q(""));
10
11var_dump(gmp_div_q(0,1));
12var_dump(gmp_div_q(1,0));
13var_dump(gmp_div_q(12653,23482734));
14var_dump(gmp_div_q(12653,23482734, 10));
15var_dump(gmp_div_q(1123123,123));
16var_dump(gmp_div_q(1123123,123, 1));
17var_dump(gmp_div_q(1123123,123, 2));
18var_dump(gmp_div_q(1123123,123, GMP_ROUND_ZERO));
19var_dump(gmp_div_q(1123123,123, GMP_ROUND_PLUSINF));
20var_dump(gmp_div_q(1123123,123, GMP_ROUND_MINUSINF));
21
22$fp = fopen(__FILE__, 'r');
23
24var_dump(gmp_div_q($fp, $fp));
25var_dump(gmp_div_q(array(), array()));
26
27echo "Done\n";
28?>
29--EXPECTF--
30Warning: gmp_div_q() expects at least 2 parameters, 0 given in %s on line %d
31NULL
32
33Warning: gmp_div_q() expects at least 2 parameters, 1 given in %s on line %d
34NULL
35object(GMP)#%d (1) {
36  ["num"]=>
37  string(1) "0"
38}
39
40Warning: gmp_div_q(): Zero operand not allowed in %s on line %d
41bool(false)
42object(GMP)#%d (1) {
43  ["num"]=>
44  string(1) "0"
45}
46
47Warning: gmp_div_q(): Invalid rounding mode %s on line %d
48bool(false)
49object(GMP)#%d (1) {
50  ["num"]=>
51  string(4) "9131"
52}
53object(GMP)#%d (1) {
54  ["num"]=>
55  string(4) "9132"
56}
57object(GMP)#%d (1) {
58  ["num"]=>
59  string(4) "9131"
60}
61object(GMP)#%d (1) {
62  ["num"]=>
63  string(4) "9131"
64}
65object(GMP)#%d (1) {
66  ["num"]=>
67  string(4) "9132"
68}
69object(GMP)#%d (1) {
70  ["num"]=>
71  string(4) "9131"
72}
73
74Warning: gmp_div_q(): Unable to convert variable to GMP - wrong type in %s on line %d
75bool(false)
76
77Warning: gmp_div_q(): Unable to convert variable to GMP - wrong type in %s on line %d
78bool(false)
79Done
80