diff options
Diffstat (limited to 'ext/bcmath/tests')
| -rw-r--r-- | ext/bcmath/tests/bcpow_error1.phpt | 11 | ||||
| -rw-r--r-- | ext/bcmath/tests/bcpow_error2.phpt | 11 | ||||
| -rw-r--r-- | ext/bcmath/tests/bcpowmod.phpt | 14 | ||||
| -rw-r--r-- | ext/bcmath/tests/bcpowmod_negative_exponent.phpt | 2 | ||||
| -rw-r--r-- | ext/bcmath/tests/bcpowmod_zero_modulus.phpt | 2 | ||||
| -rw-r--r-- | ext/bcmath/tests/bcsqrt_error1.phpt | 2 | ||||
| -rw-r--r-- | ext/bcmath/tests/bug72093.phpt | 12 | ||||
| -rw-r--r-- | ext/bcmath/tests/bug75178.phpt | 21 | ||||
| -rw-r--r-- | ext/bcmath/tests/bug78878.phpt | 8 |
9 files changed, 51 insertions, 32 deletions
diff --git a/ext/bcmath/tests/bcpow_error1.phpt b/ext/bcmath/tests/bcpow_error1.phpt index 822b70eb86..38d9bda181 100644 --- a/ext/bcmath/tests/bcpow_error1.phpt +++ b/ext/bcmath/tests/bcpow_error1.phpt @@ -6,8 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- <?php -var_dump(bcpow('1', '1.1', 2)); +try { + var_dump(bcpow('1', '1.1', 2)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpow(): Non-zero scale in exponent in %s on line %d -string(4) "1.00" +--EXPECT-- +bcpow(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bcpow_error2.phpt b/ext/bcmath/tests/bcpow_error2.phpt index 95c3f80b08..d6271b18eb 100644 --- a/ext/bcmath/tests/bcpow_error2.phpt +++ b/ext/bcmath/tests/bcpow_error2.phpt @@ -6,8 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- <?php -var_dump(bcpow('0', '9223372036854775808', 2)); +try { + var_dump(bcpow('0', '9223372036854775808', 2)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpow(): Exponent too large in %s on line %d -string(4) "1.00" +--EXPECT-- +bcpow(): Argument #2 ($exponent) is too large diff --git a/ext/bcmath/tests/bcpowmod.phpt b/ext/bcmath/tests/bcpowmod.phpt index 5f0fa8a93b..c171e2d4a1 100644 --- a/ext/bcmath/tests/bcpowmod.phpt +++ b/ext/bcmath/tests/bcpowmod.phpt @@ -6,11 +6,13 @@ bcpowmod() - Raise an arbitrary precision number to another, reduced by a specif bcmath.scale=0 --FILE-- <?php -echo bcpowmod("5", "2", "7") . "\n"; -echo bcpowmod("-2", "5", "7") . "\n"; -echo bcpowmod("10", "2147483648", "2047"); +var_dump(bcpowmod("5", "2", "7")); +var_dump(bcpowmod("-2", "5", "7")); +var_dump(bcpowmod("10", "2147483648", "2047")); +var_dump(bcpowmod("10", "0", "2047")); ?> --EXPECT-- -4 --4 -790 +string(1) "4" +string(2) "-4" +string(3) "790" +string(1) "1" diff --git a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt index a72b39548b..518f9eb0a9 100644 --- a/ext/bcmath/tests/bcpowmod_negative_exponent.phpt +++ b/ext/bcmath/tests/bcpowmod_negative_exponent.phpt @@ -13,4 +13,4 @@ try { } ?> --EXPECT-- -bcpowmod(): Argument #2 ($exponent) must be greater than 0 +bcpowmod(): Argument #2 ($exponent) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt index 0b810969c6..bc30dc0afd 100644 --- a/ext/bcmath/tests/bcpowmod_zero_modulus.phpt +++ b/ext/bcmath/tests/bcpowmod_zero_modulus.phpt @@ -7,7 +7,7 @@ Gabriel Caruso (carusogabriel34@gmail.com) --FILE-- <?php try { - var_dump(bcpowmod('1', '-1', '0')); + var_dump(bcpowmod('1', '1', '0')); } catch (DivisionByZeroError $ex) { echo $ex->getMessage(), PHP_EOL; } diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt index bbc69f3952..83c85183f4 100644 --- a/ext/bcmath/tests/bcsqrt_error1.phpt +++ b/ext/bcmath/tests/bcsqrt_error1.phpt @@ -14,4 +14,4 @@ try { } ?> --EXPECT-- -Square root of negative number +bcsqrt(): Argument #1 ($operand) must be greater than or equal to 0 diff --git a/ext/bcmath/tests/bug72093.phpt b/ext/bcmath/tests/bug72093.phpt index 7111bf6e3a..3a6405d04a 100644 --- a/ext/bcmath/tests/bug72093.phpt +++ b/ext/bcmath/tests/bug72093.phpt @@ -11,10 +11,12 @@ try { } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } -var_dump(bcpowmod(1, 1.2, 1, 1)); +try { + var_dump(bcpowmod(1, 1.2, 1, 1)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- +--EXPECT-- bcpowmod(): Argument #4 ($scale) must be between 0 and 2147483647 - -Warning: bcpowmod(): Non-zero scale in exponent in %s on line %d -string(3) "0.0" +bcpowmod(): Argument #2 ($exponent) cannot have a fractional part diff --git a/ext/bcmath/tests/bug75178.phpt b/ext/bcmath/tests/bug75178.phpt index 2b7ab4b2c6..4804452384 100644 --- a/ext/bcmath/tests/bug75178.phpt +++ b/ext/bcmath/tests/bug75178.phpt @@ -6,12 +6,17 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension is not available'); ?> --FILE-- <?php -var_dump(bcpowmod('4.1', '4', '3', 3)); -var_dump(bcpowmod('4', '4', '3.1', 3)); +try { + var_dump(bcpowmod('4.1', '4', '3', 3)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} +try { + var_dump(bcpowmod('4', '4', '3.1', 3)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> ---EXPECTF-- -Warning: bcpowmod(): Non-zero scale in base in %s on line %d -string(5) "1.000" - -Warning: bcpowmod(): Non-zero scale in modulus in %s on line %d -string(5) "1.000" +--EXPECT-- +bcpowmod(): Argument #1 ($base) cannot have a fractional part +bcpowmod(): Argument #3 ($modulus) cannot have a fractional part diff --git a/ext/bcmath/tests/bug78878.phpt b/ext/bcmath/tests/bug78878.phpt index 066d411c90..7edc666f75 100644 --- a/ext/bcmath/tests/bug78878.phpt +++ b/ext/bcmath/tests/bug78878.phpt @@ -6,7 +6,11 @@ if (!extension_loaded('bcmath')) die('skip bcmath extension not available'); ?> --FILE-- <?php -print @bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4)); +try { + print bcmul("\xB26483605105519922841849335928742092", bcpowmod(2, 65535, -4e-4)); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} ?> --EXPECT-- -0 +bcpowmod(): Argument #3 ($modulus) cannot have a fractional part |
