summaryrefslogtreecommitdiff
path: root/ext/standard/tests/math/bindec_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/bindec_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/bindec_error.phpt')
-rw-r--r--ext/standard/tests/math/bindec_error.phpt28
1 files changed, 27 insertions, 1 deletions
diff --git a/ext/standard/tests/math/bindec_error.phpt b/ext/standard/tests/math/bindec_error.phpt
index 7f7fb9ef93..8cf3cf7028 100644
--- a/ext/standard/tests/math/bindec_error.phpt
+++ b/ext/standard/tests/math/bindec_error.phpt
@@ -1,11 +1,37 @@
--TEST--
-Test bindec() - basic function test bindec()
+Test bindec() function : error conditions - incorrect input
--FILE--
<?php
+/* Prototype : number bindec ( string $binary_string )
+ * Description: Returns the decimal equivalent of the binary number represented by the binary_string argument.
+ * Source code: ext/standard/math.c
+ */
+
+/*
+ * Pass incorrect input to bindec() to test behaviour
+ */
+
+echo "*** Testing bindec() : error conditions ***\n";
+
+// get a class
+class classA
+{
+}
+
+echo "Incorrect number of arguments\n";
bindec();
bindec('01010101111',true);
+
+echo "Incorrect input\n";
+bindec(new classA());
?>
--EXPECTF--
+*** Testing bindec() : error conditions ***
+Incorrect number of arguments
+
Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
+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