]> granicus.if.org Git - php/commitdiff
add test
authorStanislav Malyshev <stas@php.net>
Mon, 25 Apr 2005 11:18:44 +0000 (11:18 +0000)
committerStanislav Malyshev <stas@php.net>
Mon, 25 Apr 2005 11:18:44 +0000 (11:18 +0000)
ext/gmp/tests/bug32773.phpt [new file with mode: 0644]

diff --git a/ext/gmp/tests/bug32773.phpt b/ext/gmp/tests/bug32773.phpt
new file mode 100644 (file)
index 0000000..0890362
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #32773 binary GMP functions returns unexpected value, when second parameter is int(0)
+--SKIPIF--
+<?php if (!extension_loaded("gmp")) print "skip"; ?>
+--POST--
+--GET--
+--FILE--
+<?
+echo '10 + 0 = ', gmp_strval(gmp_add(10, 0)), "\n";
+echo '10 + "0" = ', gmp_strval(gmp_add(10, '0')), "\n";
+                                                                                                              
+echo gmp_strval(gmp_div(10, 0))."\n";
+echo gmp_strval(gmp_div_qr(10, 0))."\n";
+                                                                                                              
+?>
+--EXPECTF--
+10 + 0 = 10
+10 + "0" = 10
+
+Warning: gmp_div(): Zero operand not allowed in %s on line %d
+0
+
+Warning: gmp_div_qr(): Zero operand not allowed in %s on line %d
+0