Annotation of embedaddon/php/ext/standard/tests/math/base_convert_error.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test base_convert() function :  error conditions - incorrect input
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string base_convert  ( string $number  , int $frombase  , int $tobase  )
                      6:  * Description: Convert a number between arbitrary bases.
                      7:  * Source code: ext/standard/math.c
                      8:  */
                      9: 
                     10: echo "*** Testing base_convert() : error conditions ***\n";
                     11: 
                     12: // get a class
                     13: class classA
                     14: {
                     15: }
                     16: 
                     17: echo "Incorrect number of arguments\n";
                     18: base_convert();
                     19: base_convert(35);
                     20: base_convert(35,2);
                     21: base_convert(1234, 1, 10);
                     22: base_convert(1234, 10, 37);
                     23: 
                     24: echo "Incorrect input\n";
                     25: base_convert(new classA(), 8, 10);
                     26: 
                     27: ?>
                     28: --EXPECTF--
                     29: *** Testing base_convert() : error conditions ***
                     30: Incorrect number of arguments
                     31: 
                     32: Warning: base_convert() expects exactly 3 parameters, 0 given in %s on line %d
                     33: 
                     34: Warning: base_convert() expects exactly 3 parameters, 1 given in %s on line %d
                     35: 
                     36: Warning: base_convert() expects exactly 3 parameters, 2 given in %s on line %d
                     37: 
                     38: Warning: base_convert(): Invalid `from base' (1) in %s on line %d
                     39: 
                     40: Warning: base_convert(): Invalid `to base' (37) in %s on line %s
                     41: Incorrect input
                     42: 
                     43: Catchable fatal error: Object of class classA could not be converted to string in %s on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>