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