xref: /PHP-5.3/ext/gmp/tests/008.phpt (revision eb5bd09c)
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(gmp_strval($r));
13var_dump($r = gmp_div_r(1,0));
14var_dump($r = gmp_div_r(12653,23482734));
15var_dump(gmp_strval($r));
16var_dump($r = gmp_div_r(12653,23482734, 10));
17var_dump(gmp_strval($r));
18var_dump($r = gmp_div_r(1123123,123));
19var_dump(gmp_strval($r));
20var_dump($r = gmp_div_r(1123123,123, 1));
21var_dump(gmp_strval($r));
22var_dump($r = gmp_div_r(1123123,123, 2));
23var_dump(gmp_strval($r));
24var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_ZERO));
25var_dump(gmp_strval($r));
26var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_PLUSINF));
27var_dump(gmp_strval($r));
28var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_MINUSINF));
29var_dump(gmp_strval($r));
30
31$fp = fopen(__FILE__, 'r');
32
33var_dump(gmp_div_r($fp, $fp));
34var_dump(gmp_div_r(array(), array()));
35
36echo "Done\n";
37?>
38--EXPECTF--
39Warning: gmp_div_r() expects at least 2 parameters, 0 given in %s on line %d
40NULL
41
42Warning: gmp_div_r() expects at least 2 parameters, 1 given in %s on line %d
43NULL
44int(0)
45string(1) "0"
46
47Warning: gmp_div_r(): Zero operand not allowed in %s on line %d
48bool(false)
49int(12653)
50string(5) "12653"
51NULL
52
53Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
54bool(false)
55int(10)
56string(2) "10"
57int(113)
58string(3) "113"
59int(10)
60string(2) "10"
61int(10)
62string(2) "10"
63int(113)
64string(3) "113"
65int(10)
66string(2) "10"
67
68Warning: gmp_div_r(): supplied resource is not a valid GMP integer resource in %s on line %d
69bool(false)
70
71Warning: gmp_div_r(): Unable to convert variable to GMP - wrong type in %s on line %d
72bool(false)
73Done
74