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

1.1       misho       1: --TEST--
                      2: Test sprintf() function : basic functionality - unsigned 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  : string sprintf(string $format [, mixed $arg1 [, mixed ...]])
                     12:  * Description: Return a formatted string 
                     13:  * Source code: ext/standard/formatted_print.c
                     14:  */
                     15: 
                     16: echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n";
                     17: 
                     18: 
                     19: // Initialise all required variables
                     20: $format = "format";
                     21: $format1 = "%u";
                     22: $format2 = "%u %u";
                     23: $format3 = "%u %u %u";
                     24: $arg1 = -1111;
                     25: $arg2 = -1234567;
                     26: $arg3 = +2345432;
                     27: 
                     28: // Calling sprintf() with default arguments
                     29: var_dump( sprintf($format) );
                     30: 
                     31: // Calling sprintf() with two arguments
                     32: var_dump( sprintf($format1, $arg1) );
                     33: 
                     34: // Calling sprintf() with three arguments
                     35: var_dump( sprintf($format2, $arg1, $arg2) );
                     36: 
                     37: // Calling sprintf() with four arguments
                     38: var_dump( sprintf($format3, $arg1, $arg2, $arg3) );
                     39: 
                     40: echo "Done";
                     41: ?>
                     42: --EXPECTF--
                     43: *** Testing sprintf() : basic functionality - using unsigned format ***
                     44: string(6) "format"
                     45: string(10) "4294966185"
                     46: string(21) "4294966185 4293732729"
                     47: string(29) "4294966185 4293732729 2345432"
                     48: Done

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