Annotation of embedaddon/php/ext/standard/tests/strings/vprintf_variation19.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Test vprintf() function : usage variations - with whitespaces in format strings
        !             3: --SKIPIF--
        !             4: <?php
        !             5: if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
        !             6: ?>
        !             7: --FILE--
        !             8: <?php
        !             9: /* Prototype  : string vprintf(string $format , array $args)
        !            10:  * Description: Output a formatted string 
        !            11:  * Source code: ext/standard/formatted_print.c
        !            12: */
        !            13: 
        !            14: echo "*** Testing vprintf() : with  white spaces in format strings ***\n";
        !            15: 
        !            16: // initializing the format array
        !            17: $formats = array(
        !            18:   "% d  %  d  %   d",
        !            19:   "% f  %  f  %   f",
        !            20:   "% F  %  F  %   F",
        !            21:   "% b  %  b  %   b",
        !            22:   "% c  %  c  %   c",
        !            23:   "% e  %  e  %   e",
        !            24:   "% u  %  u  %   u",
        !            25:   "% o  %  o  %   o",
        !            26:   "% x  %  x  %   x",
        !            27:   "% X  %  X  %   X",
        !            28:   "% E  %  E  %   E"
        !            29: );
        !            30: 
        !            31: // initializing the args array
        !            32: 
        !            33: $args_array = array(
        !            34:   array(111, 222, 333),
        !            35:   array(1.1, .2, -0.6),
        !            36:   array(1.12, -1.13, +0.23),
        !            37:   array(1, 2, 3),
        !            38:   array(65, 66, 67),
        !            39:   array(2e1, 2e-1, -2e1),
        !            40:   array(-11, +22, 33),
        !            41:   array(012, -02394, +02389),
        !            42:   array(0x11, -0x22, +0x33),
        !            43:   array(0x11, -0x22, +0x33),
        !            44:   array(2e1, 2e-1, -2e1)
        !            45: );
        !            46: 
        !            47: $counter = 1;
        !            48: foreach($formats as $format) {
        !            49:   echo"\n-- Iteration $counter --\n";
        !            50:   $result = vprintf($format, $args_array[$counter-1]);
        !            51:   echo "\n";
        !            52:   var_dump($result);
        !            53:   $counter++;
        !            54: }
        !            55: 
        !            56: ?>
        !            57: ===DONE===
        !            58: --EXPECT--
        !            59: *** Testing vprintf() : with  white spaces in format strings ***
        !            60: 
        !            61: -- Iteration 1 --
        !            62: 111  222  333
        !            63: int(13)
        !            64: 
        !            65: -- Iteration 2 --
        !            66: 1.100000  0.200000  -0.600000
        !            67: int(29)
        !            68: 
        !            69: -- Iteration 3 --
        !            70: 1.120000  -1.130000  0.230000
        !            71: int(29)
        !            72: 
        !            73: -- Iteration 4 --
        !            74: 1  10  11
        !            75: int(9)
        !            76: 
        !            77: -- Iteration 5 --
        !            78: A  B  C
        !            79: int(7)
        !            80: 
        !            81: -- Iteration 6 --
        !            82: 2.000000e+1  2.000000e-1  -2.000000e+1
        !            83: int(38)
        !            84: 
        !            85: -- Iteration 7 --
        !            86: 4294967285  22  33
        !            87: int(18)
        !            88: 
        !            89: -- Iteration 8 --
        !            90: 12  37777777755  23
        !            91: int(19)
        !            92: 
        !            93: -- Iteration 9 --
        !            94: 11  ffffffde  33
        !            95: int(16)
        !            96: 
        !            97: -- Iteration 10 --
        !            98: 11  FFFFFFDE  33
        !            99: int(16)
        !           100: 
        !           101: -- Iteration 11 --
        !           102: 2.000000E+1  2.000000E-1  -2.000000E+1
        !           103: int(38)
        !           104: ===DONE===

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