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

1.1       misho       1: --TEST--
                      2: Test printf() function : basic functionality - octal format
                      3: --SKIPIF--
                      4: <?php
                      5: if (PHP_INT_SIZE != 4) {
                      6:            die("skip this test is for 32bit platform only");
                      7: }
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: /* Prototype  : int printf  ( string $format  [, mixed $args  [, mixed $...  ]] )
                     12:  * Description: Produces output according to format .
                     13:  * Source code: ext/standard/formatted_print.c
                     14:  */
                     15: 
                     16: echo "*** Testing printf() : basic functionality - using octal format ***\n";
                     17: 
                     18: // Initialise all required variables
                     19: $format = "format";
                     20: $format1 = "%o";
                     21: $format2 = "%o %o";
                     22: $format3 = "%o %o %o";
                     23: $arg1 = 021;
                     24: $arg2 = -0347;
                     25: $arg3 = 05678;
                     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: 
                     37: echo "\n-- Calling printf() with two arguments --\n";
                     38: $result = printf($format2, $arg1, $arg2);
                     39: echo "\n";
                     40: var_dump($result);
                     41: 
                     42: echo "\n-- Calling printf() with three arguments --\n";
                     43: $result = printf($format3, $arg1, $arg2, $arg3);
                     44: echo "\n";
                     45: var_dump($result);
                     46: 
                     47: ?>
                     48: ===DONE===
                     49: --EXPECTF--
                     50: *** Testing printf() : basic functionality - using octal format ***
                     51: 
                     52: -- Calling printf() with no arguments --
                     53: format
                     54: int(6)
                     55: 
                     56: -- Calling printf() with one arguments --
                     57: 21
                     58: int(2)
                     59: 
                     60: -- Calling printf() with two arguments --
                     61: 21 37777777431
                     62: int(14)
                     63: 
                     64: -- Calling printf() with three arguments --
                     65: 21 37777777431 567
                     66: int(18)
                     67: ===DONE===

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