forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
482 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--TEST-- | ||
gmp_intval() tests | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("gmp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(gmp_intval(1,1)); | ||
var_dump(gmp_intval("")); | ||
var_dump(gmp_intval(1.0001)); | ||
var_dump(gmp_intval("1.0001")); | ||
var_dump(gmp_intval("-1")); | ||
var_dump(gmp_intval(-1)); | ||
var_dump(gmp_intval(-2349828)); | ||
var_dump(gmp_intval(2342344)); | ||
var_dump(gmp_intval(new stdclass)); | ||
var_dump(gmp_intval(array())); | ||
|
||
$fp = fopen(__FILE__, 'r'); | ||
var_dump(gmp_intval($fp)); | ||
|
||
$g = gmp_init("12345678"); | ||
var_dump(gmp_intval($g)); | ||
|
||
echo "Done\n"; | ||
?> | ||
--EXPECTF-- | ||
Warning: Wrong parameter count for gmp_intval() in %s on line %d | ||
NULL | ||
int(0) | ||
int(1) | ||
int(1) | ||
int(-1) | ||
int(-1) | ||
int(-2349828) | ||
int(2342344) | ||
|
||
Notice: Object of class stdClass could not be converted to int in %s on line %d | ||
int(1) | ||
int(0) | ||
|
||
Warning: gmp_intval(): supplied resource is not a valid GMP integer resource in %s on line %d | ||
bool(false) | ||
int(12345678) | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--TEST-- | ||
gmp_strval() tests | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("gmp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(gmp_strval()); | ||
var_dump(gmp_strval("")); | ||
var_dump(gmp_strval("", "")); | ||
var_dump(gmp_strval("", -1)); | ||
var_dump(gmp_strval(-1, "")); | ||
|
||
$fp = fopen(__FILE__, "r"); | ||
var_dump(gmp_strval($fp)); | ||
|
||
$g = gmp_init("9765456"); | ||
var_dump(gmp_strval($g)); | ||
var_dump(gmp_strval($g, -1)); | ||
var_dump(gmp_strval($g, 100000)); | ||
var_dump(gmp_strval($g, 10)); | ||
|
||
$g = gmp_init("-3373333"); | ||
var_dump(gmp_strval($g)); | ||
var_dump(gmp_strval($g, -1)); | ||
var_dump(gmp_strval($g, 100000)); | ||
var_dump(gmp_strval($g, 10)); | ||
|
||
var_dump(gmp_strval(array(1,2), array(1,2))); | ||
var_dump(gmp_strval(new stdclass, new stdclass)); | ||
|
||
echo "Done\n"; | ||
?> | ||
--EXPECTF-- | ||
Warning: Wrong parameter count for gmp_strval() in %s on line %d | ||
NULL | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
|
||
Warning: gmp_strval(): Bad base for conversion: 0 in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_strval(): supplied resource is not a valid GMP integer resource in %s on line %d | ||
bool(false) | ||
string(7) "9765456" | ||
|
||
Warning: gmp_strval(): Bad base for conversion: -1 in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_strval(): Bad base for conversion: 100000 in %s on line %d | ||
bool(false) | ||
string(7) "9765456" | ||
string(8) "-3373333" | ||
|
||
Warning: gmp_strval(): Bad base for conversion: -1 in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_strval(): Bad base for conversion: 100000 in %s on line %d | ||
bool(false) | ||
string(8) "-3373333" | ||
|
||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--TEST-- | ||
gmp_sub() tests | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("gmp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(gmp_sub()); | ||
var_dump(gmp_sub("")); | ||
var_dump(gmp_sub("", "")); | ||
var_dump(gmp_sub("", "", "")); | ||
var_dump(gmp_sub(array(), array())); | ||
|
||
var_dump($g = gmp_sub(10000, 10001)); | ||
var_dump(gmp_strval($g)); | ||
var_dump($g = gmp_sub(10000, -1)); | ||
var_dump(gmp_strval($g)); | ||
var_dump($g = gmp_sub(10000, new stdclass)); | ||
var_dump(gmp_strval($g)); | ||
var_dump($g = gmp_sub(new stdclass, 100)); | ||
var_dump(gmp_strval($g)); | ||
|
||
echo "Done\n"; | ||
?> | ||
--EXPECTF-- | ||
Warning: Wrong parameter count for gmp_sub() in %s on line %d | ||
NULL | ||
|
||
Warning: Wrong parameter count for gmp_sub() in %s on line %d | ||
NULL | ||
bool(false) | ||
|
||
Warning: Wrong parameter count for gmp_sub() in %s on line %d | ||
NULL | ||
|
||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
resource(%d) of type (GMP integer) | ||
string(2) "-1" | ||
resource(%d) of type (GMP integer) | ||
string(5) "10001" | ||
|
||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
string(1) "0" | ||
|
||
Warning: gmp_sub(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
string(1) "0" | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
--TEST-- | ||
gmp_div_qr() tests | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("gmp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(gmp_div_qr()); | ||
var_dump(gmp_div_qr("")); | ||
|
||
var_dump($r = gmp_div_qr(0,1)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1,0)); | ||
var_dump($r = gmp_div_qr(12653,23482734)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(12653,23482734, 10)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123, 1)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123, 2)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_ZERO)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_PLUSINF)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
var_dump($r = gmp_div_qr(1123123,123, GMP_ROUND_MINUSINF)); | ||
var_dump(gmp_strval($r[0])); | ||
var_dump(gmp_strval($r[1])); | ||
|
||
$fp = fopen(__FILE__, 'r'); | ||
|
||
var_dump(gmp_div_qr($fp, $fp)); | ||
var_dump(gmp_div_qr(array(), array())); | ||
|
||
echo "Done\n"; | ||
?> | ||
--EXPECTF-- | ||
Warning: Wrong parameter count for gmp_div_qr() in %s on line %d | ||
NULL | ||
|
||
Warning: Wrong parameter count for gmp_div_qr() in %s on line %d | ||
NULL | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(1) "0" | ||
string(1) "0" | ||
|
||
Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d | ||
bool(false) | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(1) "0" | ||
string(5) "12653" | ||
NULL | ||
|
||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9131" | ||
string(2) "10" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9132" | ||
string(4) "-113" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9131" | ||
string(2) "10" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9131" | ||
string(2) "10" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9132" | ||
string(4) "-113" | ||
array(2) { | ||
[0]=> | ||
resource(%d) of type (GMP integer) | ||
[1]=> | ||
resource(%d) of type (GMP integer) | ||
} | ||
string(4) "9131" | ||
string(2) "10" | ||
|
||
Warning: gmp_div_qr(): supplied resource is not a valid GMP integer resource in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_div_qr(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
--TEST-- | ||
gmp_div_r() tests | ||
--SKIPIF-- | ||
<?php if (!extension_loaded("gmp")) print "skip"; ?> | ||
--FILE-- | ||
<?php | ||
|
||
var_dump(gmp_div_r()); | ||
var_dump(gmp_div_r("")); | ||
|
||
var_dump($r = gmp_div_r(0,1)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1,0)); | ||
var_dump($r = gmp_div_r(12653,23482734)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(12653,23482734, 10)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123, 1)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123, 2)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_ZERO)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_PLUSINF)); | ||
var_dump(gmp_strval($r)); | ||
var_dump($r = gmp_div_r(1123123,123, GMP_ROUND_MINUSINF)); | ||
var_dump(gmp_strval($r)); | ||
|
||
$fp = fopen(__FILE__, 'r'); | ||
|
||
var_dump(gmp_div_r($fp, $fp)); | ||
var_dump(gmp_div_r(array(), array())); | ||
|
||
echo "Done\n"; | ||
?> | ||
--EXPECTF-- | ||
Warning: Wrong parameter count for gmp_div_r() in %s on line %d | ||
NULL | ||
|
||
Warning: Wrong parameter count for gmp_div_r() in %s on line %d | ||
NULL | ||
int(0) | ||
string(1) "0" | ||
|
||
Warning: gmp_div_r(): Zero operand not allowed in %s on line %d | ||
bool(false) | ||
int(12653) | ||
string(5) "12653" | ||
NULL | ||
|
||
Warning: gmp_strval(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
int(10) | ||
string(2) "10" | ||
int(113) | ||
string(3) "113" | ||
int(10) | ||
string(2) "10" | ||
int(10) | ||
string(2) "10" | ||
int(113) | ||
string(3) "113" | ||
int(10) | ||
string(2) "10" | ||
|
||
Warning: gmp_div_r(): supplied resource is not a valid GMP integer resource in %s on line %d | ||
bool(false) | ||
|
||
Warning: gmp_div_r(): Unable to convert variable to GMP - wrong type in %s on line %d | ||
bool(false) | ||
Done |
Oops, something went wrong.