xref: /PHP-5.5/ext/gmp/tests/007.phpt (revision eb5bd09c)
1--TEST--
2gmp_div_qr() tests
3--SKIPIF--
4<?php if (!extension_loaded("gmp")) print "skip"; ?>
5--FILE--
6<?php
7
8var_dump(gmp_div_qr());
9var_dump(gmp_div_qr(""));
10
11var_dump($r = gmp_div_qr(0,1));
12var_dump(gmp_strval($r[0]));
13var_dump(gmp_strval($r[1]));
14var_dump($r = gmp_div_qr(1,0));
15var_dump($r = gmp_div_qr(12653,23482734));
16var_dump(gmp_strval($r[0]));
17var_dump(gmp_strval($r[1]));
18var_dump($r = gmp_div_qr(12653,23482734, 10));
19var_dump(gmp_strval($r[0]));
20var_dump(gmp_strval($r[1]));
21var_dump($r = gmp_div_qr(1123123,123));
22var_dump(gmp_strval($r[0]));
23var_dump(gmp_strval($r[1]));
24var_dump($r = gmp_div_qr(1123123,123, 1));
25var_dump(gmp_strval($r[0]));
26var_dump(gmp_strval($r[1]));
27var_dump($r = gmp_div_qr(1123123,123, 2));
28var_dump(gmp_strval($r[0]));
29var_dump(gmp_strval($r[1]));
30var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_ZERO));
31var_dump(gmp_strval($r[0]));
32var_dump(gmp_strval($r[1]));
33var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_PLUSINF));
34var_dump(gmp_strval($r[0]));
35var_dump(gmp_strval($r[1]));
36var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_MINUSINF));
37var_dump(gmp_strval($r[0]));
38var_dump(gmp_strval($r[1]));
39
40$fp = fopen(__FILE__, 'r');
41
42var_dump(gmp_div_qr($fp, $fp));
43var_dump(gmp_div_qr(array(), array()));
44
45echo "Done\n";
46?>
47--EXPECTF--
48Warning: gmp_div_qr() expects at least 2 parameters, 0 given in %s on line %d
49NULL
50
51Warning: gmp_div_qr() expects at least 2 parameters, 1 given in %s on line %d
52NULL
53array(2) {
54  [0]=>
55  resource(%d) of type (GMP integer)
56  [1]=>
57  resource(%d) of type (GMP integer)
58}
59string(1) "0"
60string(1) "0"
61
62Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
63bool(false)
64array(2) {
65  [0]=>
66  resource(%d) of type (GMP integer)
67  [1]=>
68  resource(%d) of type (GMP integer)
69}
70string(1) "0"
71string(5) "12653"
72NULL
73
74Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
75bool(false)
76
77Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d
78bool(false)
79array(2) {
80  [0]=>
81  resource(%d) of type (GMP integer)
82  [1]=>
83  resource(%d) of type (GMP integer)
84}
85string(4) "9131"
86string(2) "10"
87array(2) {
88  [0]=>
89  resource(%d) of type (GMP integer)
90  [1]=>
91  resource(%d) of type (GMP integer)
92}
93string(4) "9132"
94string(4) "-113"
95array(2) {
96  [0]=>
97  resource(%d) of type (GMP integer)
98  [1]=>
99  resource(%d) of type (GMP integer)
100}
101string(4) "9131"
102string(2) "10"
103array(2) {
104  [0]=>
105  resource(%d) of type (GMP integer)
106  [1]=>
107  resource(%d) of type (GMP integer)
108}
109string(4) "9131"
110string(2) "10"
111array(2) {
112  [0]=>
113  resource(%d) of type (GMP integer)
114  [1]=>
115  resource(%d) of type (GMP integer)
116}
117string(4) "9132"
118string(4) "-113"
119array(2) {
120  [0]=>
121  resource(%d) of type (GMP integer)
122  [1]=>
123  resource(%d) of type (GMP integer)
124}
125string(4) "9131"
126string(2) "10"
127
128Warning: gmp_div_qr(): supplied resource is not a valid GMP integer resource in %s on line %d
129bool(false)
130
131Warning: gmp_div_qr(): Unable to convert variable to GMP - wrong type in %s on line %d
132bool(false)
133Done
134