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