0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 18:41:52 +00:00
phpv8/tests/long.phpt
2014-03-20 15:45:35 +02:00

45 lines
876 B
PHP

--TEST--
Test V8::executeString() : Check long integer handling from PHP to JS
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
$v8 = new V8Js();
$v8->long = pow(2, 31);
try {
$v8->executeString('print(PHP.long); print("\n");');
} catch (V8JsScriptException $e) {
var_dump($e->getMessage());
}
$v8->long = pow(2, 31) + 1;
try {
$v8->executeString('print(PHP.long); print("\n");');
} catch (V8JsScriptException $e) {
var_dump($e->getMessage());
}
$v8->long = -pow(2, 31);
try {
$v8->executeString('print(PHP.long); print("\n");');
} catch (V8JsScriptException $e) {
var_dump($e->getMessage());
}
$v8->long = -pow(2, 31) - 1;
try {
$v8->executeString('print(PHP.long); print("\n");');
} catch (V8JsScriptException $e) {
var_dump($e->getMessage());
}
?>
===EOF===
--EXPECT--
2147483648
2147483649
-2147483648
-2147483649
===EOF===