Annotation of embedaddon/php/ext/standard/tests/strings/printf_basic3.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test printf() function : basic functionality - float format
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
                      6:  * Description: Produces output according to format .
                      7:  * Source code: ext/standard/formatted_print.c
                      8:  */
                      9: 
                     10: echo "*** Testing printf() : basic functionality - using float format ***\n";
                     11: 
                     12: 
                     13: // Initialise all required variables
                     14: 
                     15: $format = "format";
                     16: $format1 = "%f";
                     17: $format2 = "%f %f";
                     18: $format3 = "%f %f %f";
                     19: 
                     20: $format11 = "%F";
                     21: $format22 = "%F %F";
                     22: $format33 = "%F %F %F";
                     23: $arg1 = 11.11;
                     24: $arg2 = 22.22;
                     25: $arg3 = 33.33;
                     26: 
                     27: echo "\n-- Calling printf() with no arguments--\n";
                     28: $result = printf($format);
                     29: echo "\n";
                     30: var_dump($result);
                     31: 
                     32: echo "\n-- Calling printf() with one arguments--\n";
                     33: $result = printf($format1, $arg1);
                     34: echo "\n";
                     35: var_dump($result);
                     36: $result = printf($format11, $arg1);
                     37: echo "\n";
                     38: var_dump($result);
                     39: 
                     40: echo "\n-- Calling printf() with two arguments--\n";
                     41: $result = printf($format2, $arg1, $arg2);
                     42: echo "\n";
                     43: var_dump($result);
                     44: $result = printf($format22, $arg1, $arg2);
                     45: echo "\n";
                     46: var_dump($result);
                     47: 
                     48: echo "\n-- Calling printf() with three arguments--\n";
                     49: $result = printf($format3, $arg1, $arg2, $arg3);
                     50: echo "\n";
                     51: var_dump($result);
                     52: $result = printf($format33, $arg1, $arg2, $arg3);
                     53: echo "\n";
                     54: var_dump($result);
                     55: 
                     56: ?>
                     57: ===DONE===
                     58: --EXPECTF--
                     59: *** Testing printf() : basic functionality - using float format ***
                     60: 
                     61: -- Calling printf() with no arguments--
                     62: format
                     63: int(6)
                     64: 
                     65: -- Calling printf() with one arguments--
                     66: 11.110000
                     67: int(9)
                     68: 11.110000
                     69: int(9)
                     70: 
                     71: -- Calling printf() with two arguments--
                     72: 11.110000 22.220000
                     73: int(19)
                     74: 11.110000 22.220000
                     75: int(19)
                     76: 
                     77: -- Calling printf() with three arguments--
                     78: 11.110000 22.220000 33.330000
                     79: int(29)
                     80: 11.110000 22.220000 33.330000
                     81: int(29)
                     82: ===DONE===

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