summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/base_convert_error.phpt
diff options
context:
space:
mode:
authorandy wharmby <wharmby@php.net>2009-01-08 21:20:11 +0000
committerandy wharmby <wharmby@php.net>2009-01-08 21:20:11 +0000
commita7bdc76551139fbd09df545913d359f49ee46a99 (patch)
tree1b763290cca1bff346342027ed9823305f4aaf6b /ext/standard/tests/math/base_convert_error.phpt
parent4f07ef1f78c91a03f288784f3ba4719525eecc61 (diff)
downloadphp-git-a7bdc76551139fbd09df545913d359f49ee46a99.tar.gz
New PHPT tests for math functions. Tested on Windows, Linux and Linux 64 bit.
Diffstat (limited to 'ext/standard/tests/math/base_convert_error.phpt')
-rw-r--r--ext/standard/tests/math/base_convert_error.phpt27
1 files changed, 25 insertions, 2 deletions
diff --git a/ext/standard/tests/math/base_convert_error.phpt b/ext/standard/tests/math/base_convert_error.phpt
index 9d871dd7b5..4e35a81f36 100644
--- a/ext/standard/tests/math/base_convert_error.phpt
+++ b/ext/standard/tests/math/base_convert_error.phpt
@@ -1,14 +1,34 @@
--TEST--
-Test base_convert() - wrong params base_convert()
+Test base_convert() function : error conditions - incorrect input
--FILE--
<?php
+/* Prototype : string base_convert ( string $number , int $frombase , int $tobase )
+ * Description: Convert a number between arbitrary bases.
+ * Source code: ext/standard/math.c
+ */
+
+echo "*** Testing base_convert() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
base_convert();
base_convert(35);
base_convert(35,2);
base_convert(1234, 1, 10);
base_convert(1234, 10, 37);
+
+echo "Incorrect input\n";
+base_convert(new classA(), 8, 10);
+
?>
--EXPECTF--
+*** Testing base_convert() : error conditions ***
+Incorrect number of arguments
+
Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
@@ -17,4 +37,7 @@ Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
Warning: base_convert(): Invalid `from base' (1) in %s on line %d
-Warning: base_convert(): Invalid `to base' (37) in %s on line %d
+Warning: base_convert(): Invalid `to base' (37) in %s on line %s
+Incorrect input
+
+Catchable fatal error: Object of class classA could not be converted to string in %s on line %d \ No newline at end of file