For Programmers: Free Programming Magazines  


Home > Archive > PHP Zend Engine > September 2006 > cvs: ZendEngine2 /tests int_overflow_64bit.phpt int_underflow_64bit.phpt









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: ZendEngine2 /tests int_overflow_64bit.phpt int_underflow_64bit.phpt
Antony Dovgal

2006-09-28, 7:56 am

tony2001 Thu Sep 28 12:08:44 2006 UTC

Modified files:
/ZendEngine2/tests int_overflow_64bit.phpt int_underflow_64bit.phpt
Log:
new tests


http://cvs.php.net/viewvc.cgi/ZendE...2&diff_format=u
Index: ZendEngine2/tests/int_overflow_64bit.phpt
diff -u /dev/null ZendEngine2/tests/int_overflow_64bit.phpt:1.2
--- /dev/null Thu Sep 28 12:08:44 2006
+++ ZendEngine2/tests/int_overflow_64bit.phpt Thu Sep 28 12:08:44 2006
@@ -0,0 +1,29 @@
+--TEST--
+testing integer overflow (64bit)
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+
+$doubles = array(
+ 9223372036854775808,
+ 9223372036854775809,
+ 9223372036854775818,
+ 9223372036854775908,
+ 9223372036854776808,
+ );
+
+foreach ($doubles as $d) {
+ $l = (int)$d;
+ var_dump($l);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+Done
http://cvs.php.net/viewvc.cgi/ZendE...2&diff_format=u
Index: ZendEngine2/tests/int_underflow_64bit.phpt
diff -u /dev/null ZendEngine2/tests/int_underflow_64bit.phpt:1.2
--- /dev/null Thu Sep 28 12:08:44 2006
+++ ZendEngine2/tests/int_underflow_64bit.phpt Thu Sep 28 12:08:44 2006
@@ -0,0 +1,29 @@
+--TEST--
+testing integer underflow (64bit)
+--SKIPIF--
+<?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?>
+--FILE--
+<?php
+
+$doubles = array(
+ -9223372036854775808,
+ -9223372036854775809,
+ -9223372036854775818,
+ -9223372036854775908,
+ -9223372036854776808,
+ );
+
+foreach ($doubles as $d) {
+ $l = (int)$d;
+ var_dump($l);
+}
+
+echo "Done\n";
+?>
+--EXPECTF--
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+int(-9223372036854775808)
+Done
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com