~ubuntu-branches/ubuntu/quantal/php5/quantal

« back to all changes in this revision

Viewing changes to ext/standard/tests/math/bindec_error.phpt

  • Committer: Bazaar Package Importer
  • Author(s): Sean Finney
  • Date: 2009-07-01 09:12:10 UTC
  • mto: (0.9.1) (1.1.17 upstream)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20090701091210-go0h6506p62on17r
Tags: upstream-5.3.0
ImportĀ upstreamĀ versionĀ 5.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--TEST--
 
2
Test bindec() function :  error conditions - incorrect input
 
3
--FILE--
 
4
<?php
 
5
/* Prototype  : number bindec  ( string $binary_string  )
 
6
 * Description: Returns the decimal equivalent of the binary number represented by the binary_string  argument.
 
7
 * Source code: ext/standard/math.c
 
8
 */
 
9
 
 
10
/*
 
11
 * Pass incorrect input to bindec() to test behaviour
 
12
 */
 
13
 
 
14
echo "*** Testing bindec() : error conditions ***\n";
 
15
 
 
16
// get a class
 
17
class classA
 
18
{
 
19
}
 
20
 
 
21
echo "Incorrect number of arguments\n";
 
22
bindec();
 
23
bindec('01010101111',true);
 
24
 
 
25
echo "Incorrect input\n";
 
26
bindec(new classA());
 
27
?>
 
28
--EXPECTF--
 
29
*** Testing bindec() : error conditions ***
 
30
Incorrect number of arguments
 
31
 
 
32
Warning: bindec() expects exactly 1 parameter, 0 given in %s on line %d
 
33
 
 
34
Warning: bindec() expects exactly 1 parameter, 2 given in %s on line %d
 
35
Incorrect input
 
36
 
 
37
Catchable fatal error: Object of class classA could not be converted to string in %s on line %d
 
 
b'\\ No newline at end of file'