diff options
Diffstat (limited to 'ext/opcache/tests/jit/mod_002.phpt')
-rw-r--r-- | ext/opcache/tests/jit/mod_002.phpt | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/ext/opcache/tests/jit/mod_002.phpt b/ext/opcache/tests/jit/mod_002.phpt new file mode 100644 index 0000000000..9dada5e400 --- /dev/null +++ b/ext/opcache/tests/jit/mod_002.phpt @@ -0,0 +1,53 @@ +--TEST-- +JIT MOD: 002 +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=1M +opcache.protect_memory=1 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function mod33(int $a) { + return $a % 33; +} +function mod32(int $a) { + return $a % 32; +} +function modNeg33(int $a) { + return $a % -33; +} +function modNeg1(int $a) { + return $a % -1; +} +function mod0(int $a) { + return $a % 0; +} +var_dump(mod33(125)); +var_dump(mod32(125)); +var_dump(mod33(-125)); +var_dump(mod32(-125)); +var_dump(modNeg33(125)); +var_dump(modNeg33(-125)); +try { + var_dump(modNeg1(125)); +} catch (Throwable $e) { + echo "Exception " . $e->getMessage() . "\n"; +} +try { + var_dump(mod0(125)); +} catch (Throwable $e) { + echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; +} +?> +--EXPECT-- +int(26) +int(29) +int(-26) +int(-29) +int(26) +int(-26) +int(0) +Exception (DivisionByZeroError): Modulo by zero |