Annotation of embedaddon/php/ext/standard/tests/math/base_convert_variation3.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test base_convert() function : usage variations - different data types as $tobase argument
        !             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() : usage variations ***\n";
        !            11: 
        !            12: //get an unset variable
        !            13: $unset_var = 10;
        !            14: unset ($unset_var);
        !            15: 
        !            16: // heredoc string
        !            17: $heredoc = <<<EOT
        !            18: abc
        !            19: xyz
        !            20: EOT;
        !            21: 
        !            22: $inputs = array(
        !            23:        // int data
        !            24: /*1*/  0,
        !            25:        1,
        !            26:        -1,
        !            27:        -12,       
        !            28:        2147483647,
        !            29: 
        !            30:        // float data
        !            31: /*6*/  10.5,
        !            32:        -10.5,
        !            33:        1.234567e2,
        !            34:        1.234567E-2,
        !            35:        .5,
        !            36: 
        !            37:        // null data
        !            38: /*11*/ NULL,
        !            39:        null,
        !            40: 
        !            41:        // boolean data
        !            42: /*13*/ true,
        !            43:        false,
        !            44:        TRUE,
        !            45:        FALSE,
        !            46:        
        !            47:        // empty data
        !            48: /*17*/ "",
        !            49:        '',
        !            50:        array(),
        !            51: 
        !            52:        // string data
        !            53: /*20*/ "abcxyz",
        !            54:        'abcxyz',
        !            55:        $heredoc,
        !            56:        
        !            57:        // undefined data
        !            58: /*23*/ @$undefined_var,
        !            59: 
        !            60:        // unset data
        !            61: /*24*/ @$unset_var,
        !            62: );
        !            63: 
        !            64: // loop through each element of $inputs to check the behaviour of base_convert()
        !            65: $iterator = 1;
        !            66: foreach($inputs as $input) {
        !            67:        echo "\n-- Iteration $iterator --\n";
        !            68:        var_dump(base_convert(25, 10, $input));
        !            69:        $iterator++;
        !            70: };
        !            71: ?>
        !            72: ===Done===
        !            73: --EXPECTF--
        !            74: *** Testing base_convert() : usage variations ***
        !            75: 
        !            76: -- Iteration 1 --
        !            77: 
        !            78: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !            79: bool(false)
        !            80: 
        !            81: -- Iteration 2 --
        !            82: 
        !            83: Warning: base_convert(): Invalid `to base' (1) in %s on line %d
        !            84: bool(false)
        !            85: 
        !            86: -- Iteration 3 --
        !            87: 
        !            88: Warning: base_convert(): Invalid `to base' (-1) in %s on line %d
        !            89: bool(false)
        !            90: 
        !            91: -- Iteration 4 --
        !            92: 
        !            93: Warning: base_convert(): Invalid `to base' (-12) in %s on line %d
        !            94: bool(false)
        !            95: 
        !            96: -- Iteration 5 --
        !            97: 
        !            98: Warning: base_convert(): Invalid `to base' (2147483647) in %s on line %d
        !            99: bool(false)
        !           100: 
        !           101: -- Iteration 6 --
        !           102: string(2) "25"
        !           103: 
        !           104: -- Iteration 7 --
        !           105: 
        !           106: Warning: base_convert(): Invalid `to base' (-10) in %s on line %d
        !           107: bool(false)
        !           108: 
        !           109: -- Iteration 8 --
        !           110: 
        !           111: Warning: base_convert(): Invalid `to base' (123) in %s on line %d
        !           112: bool(false)
        !           113: 
        !           114: -- Iteration 9 --
        !           115: 
        !           116: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           117: bool(false)
        !           118: 
        !           119: -- Iteration 10 --
        !           120: 
        !           121: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           122: bool(false)
        !           123: 
        !           124: -- Iteration 11 --
        !           125: 
        !           126: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           127: bool(false)
        !           128: 
        !           129: -- Iteration 12 --
        !           130: 
        !           131: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           132: bool(false)
        !           133: 
        !           134: -- Iteration 13 --
        !           135: 
        !           136: Warning: base_convert(): Invalid `to base' (1) in %s on line %d
        !           137: bool(false)
        !           138: 
        !           139: -- Iteration 14 --
        !           140: 
        !           141: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           142: bool(false)
        !           143: 
        !           144: -- Iteration 15 --
        !           145: 
        !           146: Warning: base_convert(): Invalid `to base' (1) in %s on line %d
        !           147: bool(false)
        !           148: 
        !           149: -- Iteration 16 --
        !           150: 
        !           151: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           152: bool(false)
        !           153: 
        !           154: -- Iteration 17 --
        !           155: 
        !           156: Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
        !           157: NULL
        !           158: 
        !           159: -- Iteration 18 --
        !           160: 
        !           161: Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
        !           162: NULL
        !           163: 
        !           164: -- Iteration 19 --
        !           165: 
        !           166: Warning: base_convert() expects parameter 3 to be long, array given in %s on line %d
        !           167: NULL
        !           168: 
        !           169: -- Iteration 20 --
        !           170: 
        !           171: Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
        !           172: NULL
        !           173: 
        !           174: -- Iteration 21 --
        !           175: 
        !           176: Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
        !           177: NULL
        !           178: 
        !           179: -- Iteration 22 --
        !           180: 
        !           181: Warning: base_convert() expects parameter 3 to be long, string given in %s on line %d
        !           182: NULL
        !           183: 
        !           184: -- Iteration 23 --
        !           185: 
        !           186: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           187: bool(false)
        !           188: 
        !           189: -- Iteration 24 --
        !           190: 
        !           191: Warning: base_convert(): Invalid `to base' (0) in %s on line %d
        !           192: bool(false)
        !           193: ===Done===

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