test(stdlib): cover RoundingMode enum at runtime (#78) --skip-tests

master
hafung 2 days ago committed by GitHub
parent b4919c7e76
commit cde9ed2b58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      tests/compiler/stdlib/round-mode.phpt

@ -7,6 +7,7 @@ function main()
// A valid legacy mode still produces PHP's result. // A valid legacy mode still produces PHP's result.
var_dump(round(2.5, 0, PHP_ROUND_HALF_DOWN)); var_dump(round(2.5, 0, PHP_ROUND_HALF_DOWN));
var_dump(round(3.5, 0, PHP_ROUND_HALF_ODD)); var_dump(round(3.5, 0, PHP_ROUND_HALF_ODD));
var_dump(round(2.5, 0, RoundingMode::HalfEven));
// An out-of-range integer mode must raise ValueError. The Native wrapper // An out-of-range integer mode must raise ValueError. The Native wrapper
// calls _php_math_round() directly, where the same value aborts the // calls _php_math_round() directly, where the same value aborts the
@ -47,6 +48,7 @@ function main()
--EXPECT-- --EXPECT--
float(2) float(2)
float(3) float(3)
float(2)
caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*) caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*)
caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*) caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*)
caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*) caught=round(): Argument #3 ($mode) must be a valid rounding mode (RoundingMode::*)

Loading…
Cancel
Save