summaryrefslogtreecommitdiff
path: root/ext/bcmath
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bcmath')
-rw-r--r--ext/bcmath/bcmath.c2
-rw-r--r--ext/bcmath/config.m42
-rw-r--r--ext/bcmath/config.w322
-rw-r--r--ext/bcmath/php_bcmath.h16
-rwxr-xr-xext/bcmath/tests/bcdiv_error1.phpt14
-rw-r--r--ext/bcmath/tests/bcdiv_error2.phpt13
-rw-r--r--ext/bcmath/tests/bcmod_error1.phpt13
-rwxr-xr-xext/bcmath/tests/bcpowmod_error1.phpt13
-rwxr-xr-xext/bcmath/tests/bcpowmod_error2.phpt13
-rw-r--r--ext/bcmath/tests/bcpowmod_error3.phpt13
-rwxr-xr-xext/bcmath/tests/bcsqrt_error1.phpt13
11 files changed, 99 insertions, 15 deletions
diff --git a/ext/bcmath/bcmath.c b/ext/bcmath/bcmath.c
index 8572bcf85..66485ce3f 100644
--- a/ext/bcmath/bcmath.c
+++ b/ext/bcmath/bcmath.c
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: bcmath.c,v 1.62.2.2.2.8.2.9 2008/12/31 11:15:35 sebastian Exp $ */
+/* $Id: bcmath.c 272370 2008-12-31 11:15:49Z sebastian $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/bcmath/config.m4 b/ext/bcmath/config.m4
index ea794dffd..06aaf5cad 100644
--- a/ext/bcmath/config.m4
+++ b/ext/bcmath/config.m4
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.17 2005/05/29 23:16:40 sniper Exp $
+dnl $Id: config.m4 187290 2005-05-29 23:17:16Z sniper $
dnl
PHP_ARG_ENABLE(bcmath, whether to enable bc style precision math functions,
diff --git a/ext/bcmath/config.w32 b/ext/bcmath/config.w32
index 7496c676a..e091aa9bd 100644
--- a/ext/bcmath/config.w32
+++ b/ext/bcmath/config.w32
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.2 2003/12/10 00:47:02 wez Exp $
+// $Id: config.w32 146077 2003-12-10 00:47:02Z wez $
// vim:ft=javascript
ARG_ENABLE("bcmath", "bc style precision math functions", "yes");
diff --git a/ext/bcmath/php_bcmath.h b/ext/bcmath/php_bcmath.h
index 1e8b03d66..49cdc1af0 100644
--- a/ext/bcmath/php_bcmath.h
+++ b/ext/bcmath/php_bcmath.h
@@ -16,13 +16,11 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_bcmath.h,v 1.20.2.1.2.2.2.2 2008/12/31 11:15:35 sebastian Exp $ */
+/* $Id: php_bcmath.h 287499 2009-08-20 11:19:20Z jani $ */
#ifndef PHP_BCMATH_H
#define PHP_BCMATH_H
-#if HAVE_BCMATH
-
#include "libbcmath/src/bcmath.h"
extern zend_module_entry bcmath_module_entry;
@@ -50,18 +48,12 @@ ZEND_BEGIN_MODULE_GLOBALS(bcmath)
long bc_precision;
ZEND_END_MODULE_GLOBALS(bcmath)
-#if ZTS
-#define BCG(v) TSRMG(bcmath_globals_id, zend_bcmath_globals *, v)
+#ifdef ZTS
+# define BCG(v) TSRMG(bcmath_globals_id, zend_bcmath_globals *, v)
#else
-#define BCG(v) (bcmath_globals.v)
+# define BCG(v) (bcmath_globals.v)
#endif
ZEND_EXTERN_MODULE_GLOBALS(bcmath)
-#else
-
-#define phpext_bcmath_ptr NULL
-
-#endif
-
#endif /* PHP_BCMATH_H */
diff --git a/ext/bcmath/tests/bcdiv_error1.phpt b/ext/bcmath/tests/bcdiv_error1.phpt
new file mode 100755
index 000000000..c69d36bb9
--- /dev/null
+++ b/ext/bcmath/tests/bcdiv_error1.phpt
@@ -0,0 +1,14 @@
+--TEST--
+bcdiv — Divide two arbitrary precision numbers
+--CREDITS--
+TestFest2009
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcdiv('10.99', '0');
+?>
+--EXPECTF--
+Warning: bcdiv(): Division by zero in %s.php on line %d
diff --git a/ext/bcmath/tests/bcdiv_error2.phpt b/ext/bcmath/tests/bcdiv_error2.phpt
new file mode 100644
index 000000000..a90c79e45
--- /dev/null
+++ b/ext/bcmath/tests/bcdiv_error2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcdiv — Divide two arbitrary precision numbers
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcdiv('1', '2', '3', '4');
+?>
+--EXPECTF--
+Warning: bcdiv() expects at most 3 parameters, 4 given in %s.php on line %d
diff --git a/ext/bcmath/tests/bcmod_error1.phpt b/ext/bcmath/tests/bcmod_error1.phpt
new file mode 100644
index 000000000..e36dce285
--- /dev/null
+++ b/ext/bcmath/tests/bcmod_error1.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcmod — Get modulus of an arbitrary precision number
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcmod('1', '2', '3');
+?>
+--EXPECTF--
+Warning: bcmod() expects exactly 2 parameters, 3 given in %s.php on line %d
diff --git a/ext/bcmath/tests/bcpowmod_error1.phpt b/ext/bcmath/tests/bcpowmod_error1.phpt
new file mode 100755
index 000000000..2dc292eb5
--- /dev/null
+++ b/ext/bcmath/tests/bcpowmod_error1.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcpowmod('1');
+?>
+--EXPECTF--
+Warning: bcpowmod() expects at least 3 parameters, 1 given in %s.php on line %d
diff --git a/ext/bcmath/tests/bcpowmod_error2.phpt b/ext/bcmath/tests/bcpowmod_error2.phpt
new file mode 100755
index 000000000..e0a99637c
--- /dev/null
+++ b/ext/bcmath/tests/bcpowmod_error2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcpowmod('1', '2');
+?>
+--EXPECTF--
+Warning: bcpowmod() expects at least 3 parameters, 2 given in %s.php on line %d
diff --git a/ext/bcmath/tests/bcpowmod_error3.phpt b/ext/bcmath/tests/bcpowmod_error3.phpt
new file mode 100644
index 000000000..c3f8df826
--- /dev/null
+++ b/ext/bcmath/tests/bcpowmod_error3.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcpowmod — Raise an arbitrary precision number to another, reduced by a specified modulus
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcpowmod('1', '2', '3', '4', '5');
+?>
+--EXPECTF--
+Warning: bcpowmod() expects at most 4 parameters, 5 given in %s.php on line %d
diff --git a/ext/bcmath/tests/bcsqrt_error1.phpt b/ext/bcmath/tests/bcsqrt_error1.phpt
new file mode 100755
index 000000000..1f213dbc8
--- /dev/null
+++ b/ext/bcmath/tests/bcsqrt_error1.phpt
@@ -0,0 +1,13 @@
+--TEST--
+bcsqrt — Get the square root of an arbitrary precision number
+--CREDITS--
+Antoni Torrents
+antoni@solucionsinternet.com
+--SKIPIF--
+<?php if(!extension_loaded("bcmath")) print "skip"; ?>
+--FILE--
+<?php
+echo bcsqrt('-9');
+?>
+--EXPECTF--
+Warning: bcsqrt(): Square root of negative number in %s.php on line %d