com php-src: Added test cases for ZEND_SIGNED_MULTIPLY_LO NG(): Zend/tests/zend_signed_multiply-32bit.p hpt Zend/tests/zend_signed_multiply-64bit.phpt
| From: | Ard Biesheuvel | Date: | Thu, 17 Jan 2013 16:41:58 +0000 |
| Subject: | com php-src: Added test cases for ZEND_SIGNED_MULTIPLY_LO NG(): Zend/tests/zend_signed_multiply-32bit.p hpt Zend/tests/zend_signed_multiply-64bit.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-71010@lists.php.net to get a copy of this message | ||
Commit: abb12f5d7b82c40bc11eb374130e1607fad76d31
Author: Ard Biesheuvel <ard.biesheuvel@linaro.org> Thu, 17 Jan 2013 17:41:58 +0100
Parents: 979ca537347d8ae064abe7cf385771788cb684bd
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=abb12f5d7b82c40bc11eb374130e1607fad76d31
Log:
Added test cases for ZEND_SIGNED_MULTIPLY_LONG()
Before making changes to the implementation of
ZEND_SIGNED_MULTIPLY_LONG(), add some test cases
to make sure the various implementations remain
equivalent.
Changed paths:
A Zend/tests/zend_signed_multiply-32bit.phpt
A Zend/tests/zend_signed_multiply-64bit.phpt
Diff:
diff --git a/Zend/tests/zend_signed_multiply-32bit.phpt b/Zend/tests/zend_signed_multiply-32bit.phpt
new file mode 100644
index 0000000..0a42bd4
--- /dev/null
+++ b/Zend/tests/zend_signed_multiply-32bit.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Zend signed multiply 32-bit
+--SKIPIF--
+<? if ((1 << 31) > 0) print "skip Running on 64-bit target"; ?>
+--FILE--
+<?php
+var_dump(0x8000 * -0xffff);
+var_dump(0x8001 * 0xfffe);
+var_dump(0x8001 * -0xffff);
+?>
+--EXPECTF--
+int(-2147450880)
+int(2147483646)
+float(-2147516415)
diff --git a/Zend/tests/zend_signed_multiply-64bit.phpt b/Zend/tests/zend_signed_multiply-64bit.phpt
new file mode 100644
index 0000000..86e5292
--- /dev/null
+++ b/Zend/tests/zend_signed_multiply-64bit.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Zend signed multiply 64-bit
+--SKIPIF--
+<? if ((1 << 31) < 0) print "skip Running on 32-bit target"; ?>
+--FILE--
+<?php
+var_dump(0x80000000 * -0xffffffff);
+var_dump(0x80000001 * 0xfffffffe);
+var_dump(0x80000001 * -0xffffffff);
+?>
+--EXPECTF--
+int(-9223372034707292160)
+int(9223372036854775806)
+float(-9.2233720390023E+18)