diff options
Diffstat (limited to 'ext/gmp/tests/gmp_neg.phpt')
| -rw-r--r-- | ext/gmp/tests/gmp_neg.phpt | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/ext/gmp/tests/gmp_neg.phpt b/ext/gmp/tests/gmp_neg.phpt index 777de69105..0bded20758 100644 --- a/ext/gmp/tests/gmp_neg.phpt +++ b/ext/gmp/tests/gmp_neg.phpt @@ -9,7 +9,13 @@ var_dump(gmp_intval(gmp_neg(0))); var_dump(gmp_intval(gmp_neg(1))); var_dump(gmp_intval(gmp_neg(-1))); var_dump(gmp_intval(gmp_neg("-1"))); -var_dump(gmp_intval(gmp_neg(""))); + +try { + var_dump(gmp_intval(gmp_neg(""))); +} catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; +} + var_dump(gmp_intval(gmp_neg(0))); $n = gmp_init("0"); @@ -17,22 +23,22 @@ var_dump(gmp_intval(gmp_neg($n))); $n = gmp_init("12345678901234567890"); var_dump(gmp_strval(gmp_neg($n))); -var_dump(gmp_neg(array())); +try { + var_dump(gmp_neg(array())); +} catch (\TypeError $e) { + echo $e->getMessage() . \PHP_EOL; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- int(0) int(-1) int(1) int(1) - -Warning: gmp_neg(): Unable to convert variable to GMP - string is not an integer in %s on line %d -int(0) +gmp_neg(): Argument #1 ($a) is not an integer string int(0) int(0) string(21) "-12345678901234567890" - -Warning: gmp_neg(): Unable to convert variable to GMP - wrong type in %s on line %d -bool(false) +gmp_neg(): Argument #1 ($a) must be of type GMP|string|int|bool, array given Done |
