cvs: php-src(PHP_5_3) /ext/standard/tests/strings sprintf_basic7_64bit.phpt sprintf_basic8_64bit.phpt sprintf_variation28_64bit.phpt
sprintf_variation29_64bit.phpt sprintf_variation34_64bit.phpt sprintf_variation35_64bit.phpt sprintf_variation40_64bit.phpt
sprintf_variation41_64bit.phpt sprintf_variation44_64bit.phpt sprintf_variation4_64bit.phpt
| From: | Dmitry Stogov | Date: | Thu, 27 Dec 2007 11:39:01 +0000 |
| Subject: | cvs: php-src(PHP_5_3) /ext/standard/tests/strings sprintf_basic7_64bit.phpt sprintf_basic8_64bit.phpt sprintf_variation28_64bit.phpt sprintf_variation29_64bit.phpt sprintf_variation34_64bit.phpt sprintf_variation35_64bit.phpt sprintf_variation40_64bit.phpt sprintf_variation41_64bit.phpt sprintf_variation44_64bit.phpt sprintf_variation4_64bit.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-47608@lists.php.net to get a copy of this message | ||
dmitry Thu Dec 27 11:39:01 2007 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/standard/tests/strings sprintf_basic7_64bit.phpt
sprintf_basic8_64bit.phpt
sprintf_variation28_64bit.phpt
sprintf_variation29_64bit.phpt
sprintf_variation34_64bit.phpt
sprintf_variation35_64bit.phpt
sprintf_variation40_64bit.phpt
sprintf_variation41_64bit.phpt
sprintf_variation44_64bit.phpt
sprintf_variation4_64bit.phpt
Log:
Added 64-bit tests (Serg)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt --TEST-- Test sprintf() function : basic functionality - unsigned format --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%u"; $format2 = "%u %u"; $format3 = "%u %u %u"; $arg1 = -1111; $arg2 = -1234567; $arg3 = +2345432; // Calling sprintf() with default arguments var_dump( sprintf($format) ); // Calling sprintf() with two arguments var_dump( sprintf($format1, $arg1) ); // Calling sprintf() with three arguments var_dump( sprintf($format2, $arg1, $arg2) ); // Calling sprintf() with four arguments var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : basic functionality - using unsigned format *** string(6) "format" string(20) "18446744073709550505" string(41) "18446744073709550505 18446744073708317049" string(49) "18446744073709550505 18446744073708317049 2345432" Done --UEXPECTF-- *** Testing sprintf() : basic functionality - using unsigned format *** unicode(6) "format" unicode(20) "18446744073709550505" unicode(41) "18446744073709550505 18446744073708317049" unicode(49) "18446744073709550505 18446744073708317049 2345432" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt --TEST-- Test sprintf() function : basic functionality - octal format --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : basic functionality - using octal format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%o"; $format2 = "%o %o"; $format3 = "%o %o %o"; $arg1 = 021; $arg2 = -0347; $arg3 = 05678; // Calling sprintf() with default arguments var_dump( sprintf($format) ); // Calling sprintf() with two arguments var_dump( sprintf($format1, $arg1) ); // Calling sprintf() with three arguments var_dump( sprintf($format2, $arg1, $arg2) ); // Calling sprintf() with four arguments var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : basic functionality - using octal format *** string(6) "format" string(2) "21" string(25) "21 1777777777777777777431" string(29) "21 1777777777777777777431 567" Done --UEXPECTF-- *** Testing sprintf() : basic functionality - using octal format *** unicode(6) "format" unicode(2) "21" unicode(25) "21 1777777777777777777431" unicode(29) "21 1777777777777777777431 567" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt --TEST-- Test sprintf() function : usage variations - octal formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : octal formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value 2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($octal_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : octal formats with integer values *** -- Iteration 1 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 2 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 3 -- string(22) "1777777777777777777777" string(1) "o" string(22) "1777777777777777777777" string(1) "o" string(23) " 1777777777777777777777" string(23) "1777777777777777777777 " string(23) " 1777777777777777777777" string(23) " 1777777777777777777777" string(22) "1777777777777777777777" string(30) " 1777777777777777777777" string(4) "0-7]" string(1) "o" -- Iteration 4 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 5 -- string(22) "1777777777760000000001" string(1) "o" string(22) "1777777777760000000001" string(1) "o" string(23) " 1777777777760000000001" string(23) "1777777777760000000001 " string(23) " 1777777777760000000001" string(23) " 1777777777760000000001" string(22) "1777777777760000000001" string(30) " 1777777777760000000001" string(4) "0-7]" string(1) "o" -- Iteration 6 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 7 -- string(11) "17777777770" string(1) "o" string(11) "17777777770" string(1) "o" string(12) " 17777777770" string(12) "17777777770 " string(12) " 17777777770" string(12) " 17777777770" string(11) "17777777770" string(30) " 17777777770" string(4) "0-7]" string(1) "o" -- Iteration 8 -- string(5) "11073" string(1) "o" string(5) "11073" string(1) "o" string(6) " 11073" string(6) "11073 " string(6) " 11073" string(6) " 11073" string(5) "11073" string(30) " 11073" string(4) "0-7]" string(1) "o" -- Iteration 9 -- string(5) "11253" string(1) "o" string(5) "11253" string(1) "o" string(6) " 11253" string(6) "11253 " string(6) " 11253" string(6) " 11253" string(5) "11253" string(30) " 11253" string(4) "0-7]" string(1) "o" -- Iteration 10 -- string(4) "7777" string(1) "o" string(4) "7777" string(1) "o" string(5) " 7777" string(5) "7777 " string(5) " 7777" string(5) " 7777" string(4) "7777" string(30) " 7777" string(4) "0-7]" string(1) "o" -- Iteration 11 -- string(3) "372" string(1) "o" string(3) "372" string(1) "o" string(4) " 372" string(4) "372 " string(4) " 372" string(4) " 372" string(4) " 372" string(30) " 372" string(4) "0-7]" string(1) "o" -- Iteration 12 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 13 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 14 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 15 -- string(3) "123" string(1) "o" string(3) "123" string(1) "o" string(4) " 123" string(4) "123 " string(4) " 123" string(4) " 123" string(4) " 123" string(30) " 123" string(4) "0-7]" string(1) "o" -- Iteration 16 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 17 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 18 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" Done --UEXPECTF-- *** Testing sprintf() : octal formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 2 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 3 -- unicode(22) "1777777777777777777777" unicode(1) "o" unicode(22) "1777777777777777777777" unicode(1) "o" unicode(23) " 1777777777777777777777" unicode(23) "1777777777777777777777 " unicode(23) " 1777777777777777777777" unicode(23) " 1777777777777777777777" unicode(22) "1777777777777777777777" unicode(30) " 1777777777777777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 4 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 5 -- unicode(22) "1777777777760000000001" unicode(1) "o" unicode(22) "1777777777760000000001" unicode(1) "o" unicode(23) " 1777777777760000000001" unicode(23) "1777777777760000000001 " unicode(23) " 1777777777760000000001" unicode(23) " 1777777777760000000001" unicode(22) "1777777777760000000001" unicode(30) " 1777777777760000000001" unicode(4) "0-7]" unicode(1) "o" -- Iteration 6 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 7 -- unicode(11) "17777777770" unicode(1) "o" unicode(11) "17777777770" unicode(1) "o" unicode(12) " 17777777770" unicode(12) "17777777770 " unicode(12) " 17777777770" unicode(12) " 17777777770" unicode(11) "17777777770" unicode(30) " 17777777770" unicode(4) "0-7]" unicode(1) "o" -- Iteration 8 -- unicode(5) "11073" unicode(1) "o" unicode(5) "11073" unicode(1) "o" unicode(6) " 11073" unicode(6) "11073 " unicode(6) " 11073" unicode(6) " 11073" unicode(5) "11073" unicode(30) " 11073" unicode(4) "0-7]" unicode(1) "o" -- Iteration 9 -- unicode(5) "11253" unicode(1) "o" unicode(5) "11253" unicode(1) "o" unicode(6) " 11253" unicode(6) "11253 " unicode(6) " 11253" unicode(6) " 11253" unicode(5) "11253" unicode(30) " 11253" unicode(4) "0-7]" unicode(1) "o" -- Iteration 10 -- unicode(4) "7777" unicode(1) "o" unicode(4) "7777" unicode(1) "o" unicode(5) " 7777" unicode(5) "7777 " unicode(5) " 7777" unicode(5) " 7777" unicode(4) "7777" unicode(30) " 7777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 11 -- unicode(3) "372" unicode(1) "o" unicode(3) "372" unicode(1) "o" unicode(4) " 372" unicode(4) "372 " unicode(4) " 372" unicode(4) " 372" unicode(4) " 372" unicode(30) " 372" unicode(4) "0-7]" unicode(1) "o" -- Iteration 12 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 13 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 14 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 15 -- unicode(3) "123" unicode(1) "o" unicode(3) "123" unicode(1) "o" unicode(4) " 123" unicode(4) "123 " unicode(4) " 123" unicode(4) " 123" unicode(4) " 123" unicode(30) " 123" unicode(4) "0-7]" unicode(1) "o" -- Iteration 16 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 17 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 18 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt --TEST-- Test sprintf() function : usage variations - octal formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : octal formats with float values ***\n"; // array of float values $float_values = array( 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.5e+5 ); // array of octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($octal_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : octal formats with float values *** -- Iteration 1 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 2 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 3 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 4 -- string(6) "303240" string(1) "o" string(6) "303240" string(1) "o" string(7) " 303240" string(7) "303240 " string(7) " 303240" string(7) " 303240" string(6) "303240" string(30) " 303240" string(4) "0-7]" string(1) "o" -- Iteration 5 -- string(22) "1777777777777774136700" string(1) "o" string(22) "1777777777777774136700" string(1) "o" string(23) " 1777777777777774136700" string(23) "1777777777777774136700 " string(23) " 1777777777777774136700" string(23) " 1777777777777774136700" string(22) "1777777777777774136700" string(30) " 1777777777777774136700" string(4) "0-7]" string(1) "o" -- Iteration 6 -- string(9) "575360400" string(1) "o" string(9) "575360400" string(1) "o" string(10) " 575360400" string(10) "575360400 " string(10) " 575360400" string(10) " 575360400" string(9) "575360400" string(30) " 575360400" string(4) "0-7]" string(1) "o" -- Iteration 7 -- string(22) "1777777777770431233000" string(1) "o" string(22) "1777777777770431233000" string(1) "o" string(23) " 1777777777770431233000" string(23) "1777777777770431233000 " string(23) " 1777777777770431233000" string(23) " 1777777777770431233000" string(22) "1777777777770431233000" string(30) " 1777777777770431233000" string(4) "0-7]" string(1) "o" -- Iteration 8 -- string(7) "4002620" string(1) "o" string(7) "4002620" string(1) "o" string(8) " 4002620" string(8) "4002620 " string(8) " 4002620" string(8) " 4002620" string(7) "4002620" string(30) " 4002620" string(4) "0-7]" string(1) "o" Done --UEXPECTF-- *** Testing sprintf() : octal formats with float values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 2 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 3 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 4 -- unicode(6) "303240" unicode(1) "o" unicode(6) "303240" unicode(1) "o" unicode(7) " 303240" unicode(7) "303240 " unicode(7) " 303240" unicode(7) " 303240" unicode(6) "303240" unicode(30) " 303240" unicode(4) "0-7]" unicode(1) "o" -- Iteration 5 -- unicode(22) "1777777777777774136700" unicode(1) "o" unicode(22) "1777777777777774136700" unicode(1) "o" unicode(23) " 1777777777777774136700" unicode(23) "1777777777777774136700 " unicode(23) " 1777777777777774136700" unicode(23) " 1777777777777774136700" unicode(22) "1777777777777774136700" unicode(30) " 1777777777777774136700" unicode(4) "0-7]" unicode(1) "o" -- Iteration 6 -- unicode(9) "575360400" unicode(1) "o" unicode(9) "575360400" unicode(1) "o" unicode(10) " 575360400" unicode(10) "575360400 " unicode(10) " 575360400" unicode(10) " 575360400" unicode(9) "575360400" unicode(30) " 575360400" unicode(4) "0-7]" unicode(1) "o" -- Iteration 7 -- unicode(22) "1777777777770431233000" unicode(1) "o" unicode(22) "1777777777770431233000" unicode(1) "o" unicode(23) " 1777777777770431233000" unicode(23) "1777777777770431233000 " unicode(23) " 1777777777770431233000" unicode(23) " 1777777777770431233000" unicode(22) "1777777777770431233000" unicode(30) " 1777777777770431233000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 8 -- unicode(7) "4002620" unicode(1) "o" unicode(7) "4002620" unicode(1) "o" unicode(8) " 4002620" unicode(8) "4002620 " unicode(8) " 4002620" unicode(8) " 4002620" unicode(7) "4002620" unicode(30) " 4002620" unicode(4) "0-7]" unicode(1) "o" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt --TEST-- Test sprintf() function : usage variations - hexa formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : hexa formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value 2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($hexa_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : hexa formats with integer values *** -- Iteration 1 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 2 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 3 -- string(16) "ffffffffffffffff" string(17) "ffffffffffffffffx" string(16) "ffffffffffffffff" string(1) "x" string(17) " ffffffffffffffff" string(17) "ffffffffffffffff " string(17) " ffffffffffffffff" string(17) " ffffffffffffffff" string(16) "ffffffffffffffff" string(30) " ffffffffffffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 4 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 5 -- string(16) "ffffffff80000001" string(17) "ffffffff80000001x" string(16) "ffffffff80000001" string(1) "x" string(17) " ffffffff80000001" string(17) "ffffffff80000001 " string(17) " ffffffff80000001" string(17) " ffffffff80000001" string(16) "ffffffff80000001" string(30) " ffffffff80000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 6 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 7 -- string(8) "7ffffff8" string(9) "7ffffff8x" string(8) "7ffffff8" string(1) "x" string(9) " 7ffffff8" string(9) "7ffffff8 " string(9) " 7ffffff8" string(9) " 7ffffff8" string(8) "7ffffff8" string(30) " 7ffffff8" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 8 -- string(4) "123b" string(5) "123bx" string(4) "123b" string(1) "x" string(5) " 123b" string(5) "123b " string(5) " 123b" string(5) " 123b" string(4) "123b" string(30) " 123b" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 9 -- string(4) "12ab" string(5) "12abx" string(4) "12ab" string(1) "x" string(5) " 12ab" string(5) "12ab " string(5) " 12ab" string(5) " 12ab" string(4) "12ab" string(30) " 12ab" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 10 -- string(3) "fff" string(4) "fffx" string(3) "fff" string(1) "x" string(4) " fff" string(4) "fff " string(4) " fff" string(4) " fff" string(4) " fff" string(30) " fff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 11 -- string(2) "fa" string(3) "fax" string(2) "fa" string(1) "x" string(3) " fa" string(3) "fa " string(3) " fa" string(3) " fa" string(4) " fa" string(30) " fa" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 12 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 13 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 14 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 15 -- string(2) "53" string(3) "53x" string(2) "53" string(1) "x" string(3) " 53" string(3) "53 " string(3) " 53" string(3) " 53" string(4) " 53" string(30) " 53" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 16 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 17 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 18 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" Done --UEXPECTF-- *** Testing sprintf() : hexa formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 2 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 3 -- unicode(16) "ffffffffffffffff" unicode(17) "ffffffffffffffffx" unicode(16) "ffffffffffffffff" unicode(1) "x" unicode(17) " ffffffffffffffff" unicode(17) "ffffffffffffffff " unicode(17) " ffffffffffffffff" unicode(17) " ffffffffffffffff" unicode(16) "ffffffffffffffff" unicode(30) " ffffffffffffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 4 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 5 -- unicode(16) "ffffffff80000001" unicode(17) "ffffffff80000001x" unicode(16) "ffffffff80000001" unicode(1) "x" unicode(17) " ffffffff80000001" unicode(17) "ffffffff80000001 " unicode(17) " ffffffff80000001" unicode(17) " ffffffff80000001" unicode(16) "ffffffff80000001" unicode(30) " ffffffff80000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 6 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 7 -- unicode(8) "7ffffff8" unicode(9) "7ffffff8x" unicode(8) "7ffffff8" unicode(1) "x" unicode(9) " 7ffffff8" unicode(9) "7ffffff8 " unicode(9) " 7ffffff8" unicode(9) " 7ffffff8" unicode(8) "7ffffff8" unicode(30) " 7ffffff8" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 8 -- unicode(4) "123b" unicode(5) "123bx" unicode(4) "123b" unicode(1) "x" unicode(5) " 123b" unicode(5) "123b " unicode(5) " 123b" unicode(5) " 123b" unicode(4) "123b" unicode(30) " 123b" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 9 -- unicode(4) "12ab" unicode(5) "12abx" unicode(4) "12ab" unicode(1) "x" unicode(5) " 12ab" unicode(5) "12ab " unicode(5) " 12ab" unicode(5) " 12ab" unicode(4) "12ab" unicode(30) " 12ab" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 10 -- unicode(3) "fff" unicode(4) "fffx" unicode(3) "fff" unicode(1) "x" unicode(4) " fff" unicode(4) "fff " unicode(4) " fff" unicode(4) " fff" unicode(4) " fff" unicode(30) " fff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 11 -- unicode(2) "fa" unicode(3) "fax" unicode(2) "fa" unicode(1) "x" unicode(3) " fa" unicode(3) "fa " unicode(3) " fa" unicode(3) " fa" unicode(4) " fa" unicode(30) " fa" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 12 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 13 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 14 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 15 -- unicode(2) "53" unicode(3) "53x" unicode(2) "53" unicode(1) "x" unicode(3) " 53" unicode(3) "53 " unicode(3) " 53" unicode(3) " 53" unicode(4) " 53" unicode(30) " 53" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 16 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 17 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 18 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt --TEST-- Test sprintf() function : usage variations - hexa formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : hexa formats with float values ***\n"; // array of float values $float_values = array( 2147483647, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // array of hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($hexa_formats as $format) { // with two arguments var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : hexa formats with float values *** -- Iteration 1 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 2 -- string(9) "800000001" string(10) "800000001x" string(9) "800000001" string(1) "x" string(10) " 800000001" string(10) "800000001 " string(10) " 800000001" string(10) " 800000001" string(9) "800000001" string(30) " 800000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 3 -- string(8) "80000001" string(9) "80000001x" string(8) "80000001" string(1) "x" string(9) " 80000001" string(9) "80000001 " string(9) " 80000001" string(9) " 80000001" string(8) "80000001" string(30) " 80000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 4 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 5 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 6 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 7 -- string(5) "186a0" string(6) "186a0x" string(5) "186a0" string(1) "x" string(6) " 186a0" string(6) "186a0 " string(6) " 186a0" string(6) " 186a0" string(5) "186a0" string(30) " 186a0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 8 -- string(16) "fffffffffff0bdc0" string(17) "fffffffffff0bdc0x" string(16) "fffffffffff0bdc0" string(1) "x" string(17) " fffffffffff0bdc0" string(17) "fffffffffff0bdc0 " string(17) " fffffffffff0bdc0" string(17) " fffffffffff0bdc0" string(16) "fffffffffff0bdc0" string(30) " fffffffffff0bdc0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 9 -- string(7) "5f5e100" string(8) "5f5e100x" string(7) "5f5e100" string(1) "x" string(8) " 5f5e100" string(8) "5f5e100 " string(8) " 5f5e100" string(8) " 5f5e100" string(7) "5f5e100" string(30) " 5f5e100" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 10 -- string(16) "ffffffffc4653600" string(17) "ffffffffc4653600x" string(16) "ffffffffc4653600" string(1) "x" string(17) " ffffffffc4653600" string(17) "ffffffffc4653600 " string(17) " ffffffffc4653600" string(17) " ffffffffc4653600" string(16) "ffffffffc4653600" string(30) " ffffffffc4653600" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 11 -- string(1) "a" string(2) "ax" string(1) "a" string(1) "x" string(2) " a" string(2) "a " string(2) " a" string(2) " a" string(4) " a" string(30) " a" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 12 -- string(6) "100590" string(7) "100590x" string(6) "100590" string(1) "x" string(7) " 100590" string(7) "100590 " string(7) " 100590" string(7) " 100590" string(6) "100590" string(30) " 100590" string(10) "0-9A-Fa-f]" string(1) "x" Done --UEXPECTF-- *** Testing sprintf() : hexa formats with float values *** -- Iteration 1 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 2 -- unicode(9) "800000001" unicode(10) "800000001x" unicode(9) "800000001" unicode(1) "x" unicode(10) " 800000001" unicode(10) "800000001 " unicode(10) " 800000001" unicode(10) " 800000001" unicode(9) "800000001" unicode(30) " 800000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 3 -- unicode(8) "80000001" unicode(9) "80000001x" unicode(8) "80000001" unicode(1) "x" unicode(9) " 80000001" unicode(9) "80000001 " unicode(9) " 80000001" unicode(9) " 80000001" unicode(8) "80000001" unicode(30) " 80000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 4 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 5 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 6 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 7 -- unicode(5) "186a0" unicode(6) "186a0x" unicode(5) "186a0" unicode(1) "x" unicode(6) " 186a0" unicode(6) "186a0 " unicode(6) " 186a0" unicode(6) " 186a0" unicode(5) "186a0" unicode(30) " 186a0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 8 -- unicode(16) "fffffffffff0bdc0" unicode(17) "fffffffffff0bdc0x" unicode(16) "fffffffffff0bdc0" unicode(1) "x" unicode(17) " fffffffffff0bdc0" unicode(17) "fffffffffff0bdc0 " unicode(17) " fffffffffff0bdc0" unicode(17) " fffffffffff0bdc0" unicode(16) "fffffffffff0bdc0" unicode(30) " fffffffffff0bdc0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 9 -- unicode(7) "5f5e100" unicode(8) "5f5e100x" unicode(7) "5f5e100" unicode(1) "x" unicode(8) " 5f5e100" unicode(8) "5f5e100 " unicode(8) " 5f5e100" unicode(8) " 5f5e100" unicode(7) "5f5e100" unicode(30) " 5f5e100" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 10 -- unicode(16) "ffffffffc4653600" unicode(17) "ffffffffc4653600x" unicode(16) "ffffffffc4653600" unicode(1) "x" unicode(17) " ffffffffc4653600" unicode(17) "ffffffffc4653600 " unicode(17) " ffffffffc4653600" unicode(17) " ffffffffc4653600" unicode(16) "ffffffffc4653600" unicode(30) " ffffffffc4653600" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 11 -- unicode(1) "a" unicode(2) "ax" unicode(1) "a" unicode(1) "x" unicode(2) " a" unicode(2) "a " unicode(2) " a" unicode(2) " a" unicode(4) " a" unicode(30) " a" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 12 -- unicode(6) "100590" unicode(7) "100590x" unicode(6) "100590" unicode(1) "x" unicode(7) " 100590" unicode(7) "100590 " unicode(7) " 100590" unicode(7) " 100590" unicode(6) "100590" unicode(30) " 100590" unicode(10) "0-9A-Fa-f]" unicode(1) "x" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value +2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with integer values *** -- Iteration 1 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(20) "18446744073709551615" string(1) "u" string(20) "18446744073709551615" string(1) "u" string(21) " 18446744073709551615" string(21) "18446744073709551615 " string(21) " 18446744073709551615" string(21) " 18446744073709551615" string(20) "18446744073709551615" string(30) " 18446744073709551615" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(20) "18446744071562067969" string(1) "u" string(20) "18446744071562067969" string(1) "u" string(21) " 18446744071562067969" string(21) "18446744071562067969 " string(21) " 18446744071562067969" string(21) " 18446744071562067969" string(20) "18446744071562067969" string(30) " 18446744071562067969" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(10) "2147483640" string(1) "u" string(10) "2147483640" string(1) "u" string(11) " 2147483640" string(11) "2147483640 " string(11) " 2147483640" string(11) " 2147483640" string(10) "2147483640" string(30) " 2147483640" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(4) "4667" string(1) "u" string(4) "4667" string(1) "u" string(5) " 4667" string(5) "4667 " string(5) " 4667" string(5) " 4667" string(4) "4667" string(30) " 4667" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(4) "4779" string(1) "u" string(4) "4779" string(1) "u" string(5) " 4779" string(5) "4779 " string(5) " 4779" string(5) " 4779" string(4) "4779" string(30) " 4779" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(4) "4095" string(1) "u" string(4) "4095" string(1) "u" string(5) " 4095" string(5) "4095 " string(5) " 4095" string(5) " 4095" string(4) "4095" string(30) " 4095" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(3) "250" string(1) "u" string(3) "250" string(1) "u" string(4) " 250" string(4) "250 " string(4) " 250" string(4) " 250" string(4) " 250" string(30) " 250" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(2) "83" string(1) "u" string(2) "83" string(1) "u" string(3) " 83" string(3) "83 " string(3) " 83" string(3) " 83" string(4) " 83" string(30) " 83" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 18 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(20) "18446744073709551615" unicode(1) "u" unicode(20) "18446744073709551615" unicode(1) "u" unicode(21) " 18446744073709551615" unicode(21) "18446744073709551615 " unicode(21) " 18446744073709551615" unicode(21) " 18446744073709551615" unicode(20) "18446744073709551615" unicode(30) " 18446744073709551615" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(20) "18446744071562067969" unicode(1) "u" unicode(20) "18446744071562067969" unicode(1) "u" unicode(21) " 18446744071562067969" unicode(21) "18446744071562067969 " unicode(21) " 18446744071562067969" unicode(21) " 18446744071562067969" unicode(20) "18446744071562067969" unicode(30) " 18446744071562067969" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(10) "2147483640" unicode(1) "u" unicode(10) "2147483640" unicode(1) "u" unicode(11) " 2147483640" unicode(11) "2147483640 " unicode(11) " 2147483640" unicode(11) " 2147483640" unicode(10) "2147483640" unicode(30) " 2147483640" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(4) "4667" unicode(1) "u" unicode(4) "4667" unicode(1) "u" unicode(5) " 4667" unicode(5) "4667 " unicode(5) " 4667" unicode(5) " 4667" unicode(4) "4667" unicode(30) " 4667" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(4) "4779" unicode(1) "u" unicode(4) "4779" unicode(1) "u" unicode(5) " 4779" unicode(5) "4779 " unicode(5) " 4779" unicode(5) " 4779" unicode(4) "4779" unicode(30) " 4779" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(4) "4095" unicode(1) "u" unicode(4) "4095" unicode(1) "u" unicode(5) " 4095" unicode(5) "4095 " unicode(5) " 4095" unicode(5) " 4095" unicode(4) "4095" unicode(30) " 4095" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(3) "250" unicode(1) "u" unicode(3) "250" unicode(1) "u" unicode(4) " 250" unicode(4) "250 " unicode(4) " 250" unicode(4) " 250" unicode(4) " 250" unicode(30) " 250" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(2) "83" unicode(1) "u" unicode(2) "83" unicode(1) "u" unicode(3) " 83" unicode(3) "83 " unicode(3) " 83" unicode(3) " 83" unicode(4) " 83" unicode(30) " 83" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 18 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with float values ***\n"; // array of float values $float_values = array( 2147483647, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, +1e5, +5e+5, +0e-5, -1e5, -1e+5, -1e-2, 1e5, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with float values *** -- Iteration 1 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(11) "34359738369" string(1) "u" string(11) "34359738369" string(1) "u" string(12) " 34359738369" string(12) "34359738369 " string(12) " 34359738369" string(12) " 34359738369" string(11) "34359738369" string(30) " 34359738369" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(10) "2147483649" string(1) "u" string(10) "2147483649" string(1) "u" string(11) " 2147483649" string(11) "2147483649 " string(11) " 2147483649" string(11) " 2147483649" string(10) "2147483649" string(30) " 2147483649" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(6) "100000" string(1) "u" string(6) "100000" string(1) "u" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(6) "500000" string(1) "u" string(6) "500000" string(1) "u" string(7) " 500000" string(7) "500000 " string(7) " 500000" string(7) " 500000" string(6) "500000" string(30) " 500000" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(20) "18446744073709451616" string(1) "u" string(20) "18446744073709451616" string(1) "u" string(21) " 18446744073709451616" string(21) "18446744073709451616 " string(21) " 18446744073709451616" string(21) " 18446744073709451616" string(20) "18446744073709451616" string(30) " 18446744073709451616" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(20) "18446744073709451616" string(1) "u" string(20) "18446744073709451616" string(1) "u" string(21) " 18446744073709451616" string(21) "18446744073709451616 " string(21) " 18446744073709451616" string(21) " 18446744073709451616" string(20) "18446744073709451616" string(30) " 18446744073709451616" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(6) "100000" string(1) "u" string(6) "100000" string(1) "u" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(9) "100000000" string(1) "u" string(9) "100000000" string(1) "u" string(10) " 100000000" string(10) "100000000 " string(10) " 100000000" string(10) " 100000000" string(9) "100000000" string(30) " 100000000" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(20) "18446744072709551616" string(1) "u" string(20) "18446744072709551616" string(1) "u" string(21) " 18446744072709551616" string(21) "18446744072709551616 " string(21) " 18446744072709551616" string(21) " 18446744072709551616" string(20) "18446744072709551616" string(30) " 18446744072709551616" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(2) "10" string(1) "u" string(2) "10" string(1) "u" string(3) " 10" string(3) "10 " string(3) " 10" string(3) " 10" string(4) " 10" string(30) " 10" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(7) "1050000" string(1) "u" string(7) "1050000" string(1) "u" string(8) " 1050000" string(8) "1050000 " string(8) " 1050000" string(8) " 1050000" string(7) "1050000" string(30) " 1050000" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with float values *** -- Iteration 1 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(11) "34359738369" unicode(1) "u" unicode(11) "34359738369" unicode(1) "u" unicode(12) " 34359738369" unicode(12) "34359738369 " unicode(12) " 34359738369" unicode(12) " 34359738369" unicode(11) "34359738369" unicode(30) " 34359738369" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(10) "2147483649" unicode(1) "u" unicode(10) "2147483649" unicode(1) "u" unicode(11) " 2147483649" unicode(11) "2147483649 " unicode(11) " 2147483649" unicode(11) " 2147483649" unicode(10) "2147483649" unicode(30) " 2147483649" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(6) "100000" unicode(1) "u" unicode(6) "100000" unicode(1) "u" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(6) "500000" unicode(1) "u" unicode(6) "500000" unicode(1) "u" unicode(7) " 500000" unicode(7) "500000 " unicode(7) " 500000" unicode(7) " 500000" unicode(6) "500000" unicode(30) " 500000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(20) "18446744073709451616" unicode(1) "u" unicode(20) "18446744073709451616" unicode(1) "u" unicode(21) " 18446744073709451616" unicode(21) "18446744073709451616 " unicode(21) " 18446744073709451616" unicode(21) " 18446744073709451616" unicode(20) "18446744073709451616" unicode(30) " 18446744073709451616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(20) "18446744073709451616" unicode(1) "u" unicode(20) "18446744073709451616" unicode(1) "u" unicode(21) " 18446744073709451616" unicode(21) "18446744073709451616 " unicode(21) " 18446744073709451616" unicode(21) " 18446744073709451616" unicode(20) "18446744073709451616" unicode(30) " 18446744073709451616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(6) "100000" unicode(1) "u" unicode(6) "100000" unicode(1) "u" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(9) "100000000" unicode(1) "u" unicode(9) "100000000" unicode(1) "u" unicode(10) " 100000000" unicode(10) "100000000 " unicode(10) " 100000000" unicode(10) " 100000000" unicode(9) "100000000" unicode(30) " 100000000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(20) "18446744072709551616" unicode(1) "u" unicode(20) "18446744072709551616" unicode(1) "u" unicode(21) " 18446744072709551616" unicode(21) "18446744072709551616 " unicode(21) " 18446744072709551616" unicode(21) " 18446744072709551616" unicode(20) "18446744072709551616" unicode(30) " 18446744072709551616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(2) "10" unicode(1) "u" unicode(2) "10" unicode(1) "u" unicode(3) " 10" unicode(3) "10 " unicode(3) " 10" unicode(3) " 10" unicode(4) " 10" unicode(30) " 10" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(7) "1050000" unicode(1) "u" unicode(7) "1050000" unicode(1) "u" unicode(8) " 1050000" unicode(8) "1050000 " unicode(8) " 1050000" unicode(8) " 1050000" unicode(7) "1050000" unicode(30) " 1050000" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with string values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with string values ***\n"; // array of string values $string_values = array( "", '', "0", '0', "1", '1', "-123", "+123", "\x01", '\x01', "\01", '\01', 'string', "string", "true", "FALSE", 'false', 'TRUE', "NULL", 'null' ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($string_values as $string_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $string_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with string values *** -- Iteration 1 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(20) "18446744073709551493" string(1) "u" string(20) "18446744073709551493" string(1) "u" string(21) " 18446744073709551493" string(21) "18446744073709551493 " string(21) " 18446744073709551493" string(21) " 18446744073709551493" string(20) "18446744073709551493" string(30) " 18446744073709551493" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(3) "123" string(1) "u" string(3) "123" string(1) "u" string(4) " 123" string(4) "123 " string(4) " 123" string(4) " 123" string(4) " 123" string(30) " 123" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 18 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 19 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 20 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with string values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(20) "18446744073709551493" unicode(1) "u" unicode(20) "18446744073709551493" unicode(1) "u" unicode(21) " 18446744073709551493" unicode(21) "18446744073709551493 " unicode(21) " 18446744073709551493" unicode(21) " 18446744073709551493" unicode(20) "18446744073709551493" unicode(30) " 18446744073709551493" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(3) "123" unicode(1) "u" unicode(3) "123" unicode(1) "u" unicode(4) " 123" unicode(4) "123 " unicode(4) " 123" unicode(4) " 123" unicode(4) " 123" unicode(30) " 123" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 18 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 19 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 20 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt --TEST-- Test sprintf() function : usage variations - int formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : integer formats with float values ***\n"; // array of float type values $float_values = array ( 2147483648, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // various integer formats $int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($int_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : integer formats with float values *** -- Iteration 1 -- string(10) "2147483648" string(1) "d" string(10) "2147483648" string(1) "d" string(11) " 2147483648" string(11) "2147483648 " string(11) " 2147483648" string(11) " 2147483648" string(10) "2147483648" string(30) " 2147483648" string(4) "0-9]" string(1) "d" -- Iteration 2 -- string(11) "34359738369" string(1) "d" string(11) "34359738369" string(1) "d" string(12) " 34359738369" string(12) "34359738369 " string(12) " 34359738369" string(12) " 34359738369" string(11) "34359738369" string(30) " 34359738369" string(4) "0-9]" string(1) "d" -- Iteration 3 -- string(10) "2147483649" string(1) "d" string(10) "2147483649" string(1) "d" string(11) " 2147483649" string(11) "2147483649 " string(11) " 2147483649" string(11) " 2147483649" string(10) "2147483649" string(30) " 2147483649" string(4) "0-9]" string(1) "d" -- Iteration 4 -- string(1) "0" string(1) "d" string(1) "0" string(1) "d" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "d" -- Iteration 5 -- string(1) "0" string(1) "d" string(1) "0" string(1) "d" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "d" -- Iteration 6 -- string(1) "1" string(1) "d" string(1) "1" string(1) "d" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "d" -- Iteration 7 -- string(6) "100000" string(1) "d" string(6) "100000" string(1) "d" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "d" -- Iteration 8 -- string(8) "-1000000" string(1) "d" string(8) "-1000000" string(1) "d" string(9) " -1000000" string(9) "-1000000 " string(9) " -1000000" string(9) " -1000000" string(8) "-1000000" string(30) " -1000000" string(4) "0-9]" string(1) "d" -- Iteration 9 -- string(9) "100000000" string(1) "d" string(9) "100000000" string(1) "d" string(10) " 100000000" string(10) "100000000 " string(10) " 100000000" string(10) " 100000000" string(9) "100000000" string(30) " 100000000" string(4) "0-9]" string(1) "d" -- Iteration 10 -- string(11) "-1000000000" string(1) "d" string(11) "-1000000000" string(1) "d" string(12) " -1000000000" string(12) "-1000000000 " string(12) " -1000000000" string(12) " -1000000000" string(11) "-1000000000" string(30) " -1000000000" string(4) "0-9]" string(1) "d" -- Iteration 11 -- string(2) "10" string(1) "d" string(2) "10" string(1) "d" string(3) " 10" string(3) "10 " string(3) " 10" string(3) " 10" string(4) " 10" string(30) " 10" string(4) "0-9]" string(1) "d" -- Iteration 12 -- string(7) "1050000" string(1) "d" string(7) "1050000" string(1) "d" string(8) " 1050000" string(8) "1050000 " string(8) " 1050000" string(8) " 1050000" string(7) "1050000" string(30) " 1050000" string(4) "0-9]" string(1) "d" Done --UEXPECTF-- *** Testing sprintf() : integer formats with float values *** -- Iteration 1 -- unicode(10) "2147483648" unicode(1) "d" unicode(10) "2147483648" unicode(1) "d" unicode(11) " 2147483648" unicode(11) "2147483648 " unicode(11) " 2147483648" unicode(11) " 2147483648" unicode(10) "2147483648" unicode(30) " 2147483648" unicode(4) "0-9]" unicode(1) "d" -- Iteration 2 -- unicode(11) "34359738369" unicode(1) "d" unicode(11) "34359738369" unicode(1) "d" unicode(12) " 34359738369" unicode(12) "34359738369 " unicode(12) " 34359738369" unicode(12) " 34359738369" unicode(11) "34359738369" unicode(30) " 34359738369" unicode(4) "0-9]" unicode(1) "d" -- Iteration 3 -- unicode(10) "2147483649" unicode(1) "d" unicode(10) "2147483649" unicode(1) "d" unicode(11) " 2147483649" unicode(11) "2147483649 " unicode(11) " 2147483649" unicode(11) " 2147483649" unicode(10) "2147483649" unicode(30) " 2147483649" unicode(4) "0-9]" unicode(1) "d" -- Iteration 4 -- unicode(1) "0" unicode(1) "d" unicode(1) "0" unicode(1) "d" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "d" -- Iteration 5 -- unicode(1) "0" unicode(1) "d" unicode(1) "0" unicode(1) "d" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "d" -- Iteration 6 -- unicode(1) "1" unicode(1) "d" unicode(1) "1" unicode(1) "d" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "d" -- Iteration 7 -- unicode(6) "100000" unicode(1) "d" unicode(6) "100000" unicode(1) "d" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 8 -- unicode(8) "-1000000" unicode(1) "d" unicode(8) "-1000000" unicode(1) "d" unicode(9) " -1000000" unicode(9) "-1000000 " unicode(9) " -1000000" unicode(9) " -1000000" unicode(8) "-1000000" unicode(30) " -1000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 9 -- unicode(9) "100000000" unicode(1) "d" unicode(9) "100000000" unicode(1) "d" unicode(10) " 100000000" unicode(10) "100000000 " unicode(10) " 100000000" unicode(10) " 100000000" unicode(9) "100000000" unicode(30) " 100000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 10 -- unicode(11) "-1000000000" unicode(1) "d" unicode(11) "-1000000000" unicode(1) "d" unicode(12) " -1000000000" unicode(12) "-1000000000 " unicode(12) " -1000000000" unicode(12) " -1000000000" unicode(11) "-1000000000" unicode(30) " -1000000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 11 -- unicode(2) "10" unicode(1) "d" unicode(2) "10" unicode(1) "d" unicode(3) " 10" unicode(3) "10 " unicode(3) " 10" unicode(3) " 10" unicode(4) " 10" unicode(30) " 10" unicode(4) "0-9]" unicode(1) "d" -- Iteration 12 -- unicode(7) "1050000" unicode(1) "d" unicode(7) "1050000" unicode(1) "d" unicode(8) " 1050000" unicode(8) "1050000 " unicode(8) " 1050000" unicode(8) " 1050000" unicode(7) "1050000" unicode(30) " 1050000" unicode(4) "0-9]" unicode(1) "d" Done
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_basic7_64bit.phpt --TEST-- Test sprintf() function : basic functionality - unsigned format --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : basic functionality - using unsigned format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%u"; $format2 = "%u %u"; $format3 = "%u %u %u"; $arg1 = -1111; $arg2 = -1234567; $arg3 = +2345432; // Calling sprintf() with default arguments var_dump( sprintf($format) ); // Calling sprintf() with two arguments var_dump( sprintf($format1, $arg1) ); // Calling sprintf() with three arguments var_dump( sprintf($format2, $arg1, $arg2) ); // Calling sprintf() with four arguments var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : basic functionality - using unsigned format *** string(6) "format" string(20) "18446744073709550505" string(41) "18446744073709550505 18446744073708317049" string(49) "18446744073709550505 18446744073708317049 2345432" Done --UEXPECTF-- *** Testing sprintf() : basic functionality - using unsigned format *** unicode(6) "format" unicode(20) "18446744073709550505" unicode(41) "18446744073709550505 18446744073708317049" unicode(49) "18446744073709550505 18446744073708317049 2345432" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_basic8_64bit.phpt --TEST-- Test sprintf() function : basic functionality - octal format --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : basic functionality - using octal format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%o"; $format2 = "%o %o"; $format3 = "%o %o %o"; $arg1 = 021; $arg2 = -0347; $arg3 = 05678; // Calling sprintf() with default arguments var_dump( sprintf($format) ); // Calling sprintf() with two arguments var_dump( sprintf($format1, $arg1) ); // Calling sprintf() with three arguments var_dump( sprintf($format2, $arg1, $arg2) ); // Calling sprintf() with four arguments var_dump( sprintf($format3, $arg1, $arg2, $arg3) ); echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : basic functionality - using octal format *** string(6) "format" string(2) "21" string(25) "21 1777777777777777777431" string(29) "21 1777777777777777777431 567" Done --UEXPECTF-- *** Testing sprintf() : basic functionality - using octal format *** unicode(6) "format" unicode(2) "21" unicode(25) "21 1777777777777777777431" unicode(29) "21 1777777777777777777431 567" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation28_64bit.phpt --TEST-- Test sprintf() function : usage variations - octal formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : octal formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value 2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($octal_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : octal formats with integer values *** -- Iteration 1 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 2 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 3 -- string(22) "1777777777777777777777" string(1) "o" string(22) "1777777777777777777777" string(1) "o" string(23) " 1777777777777777777777" string(23) "1777777777777777777777 " string(23) " 1777777777777777777777" string(23) " 1777777777777777777777" string(22) "1777777777777777777777" string(30) " 1777777777777777777777" string(4) "0-7]" string(1) "o" -- Iteration 4 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 5 -- string(22) "1777777777760000000001" string(1) "o" string(22) "1777777777760000000001" string(1) "o" string(23) " 1777777777760000000001" string(23) "1777777777760000000001 " string(23) " 1777777777760000000001" string(23) " 1777777777760000000001" string(22) "1777777777760000000001" string(30) " 1777777777760000000001" string(4) "0-7]" string(1) "o" -- Iteration 6 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 7 -- string(11) "17777777770" string(1) "o" string(11) "17777777770" string(1) "o" string(12) " 17777777770" string(12) "17777777770 " string(12) " 17777777770" string(12) " 17777777770" string(11) "17777777770" string(30) " 17777777770" string(4) "0-7]" string(1) "o" -- Iteration 8 -- string(5) "11073" string(1) "o" string(5) "11073" string(1) "o" string(6) " 11073" string(6) "11073 " string(6) " 11073" string(6) " 11073" string(5) "11073" string(30) " 11073" string(4) "0-7]" string(1) "o" -- Iteration 9 -- string(5) "11253" string(1) "o" string(5) "11253" string(1) "o" string(6) " 11253" string(6) "11253 " string(6) " 11253" string(6) " 11253" string(5) "11253" string(30) " 11253" string(4) "0-7]" string(1) "o" -- Iteration 10 -- string(4) "7777" string(1) "o" string(4) "7777" string(1) "o" string(5) " 7777" string(5) "7777 " string(5) " 7777" string(5) " 7777" string(4) "7777" string(30) " 7777" string(4) "0-7]" string(1) "o" -- Iteration 11 -- string(3) "372" string(1) "o" string(3) "372" string(1) "o" string(4) " 372" string(4) "372 " string(4) " 372" string(4) " 372" string(4) " 372" string(30) " 372" string(4) "0-7]" string(1) "o" -- Iteration 12 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 13 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 14 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" -- Iteration 15 -- string(3) "123" string(1) "o" string(3) "123" string(1) "o" string(4) " 123" string(4) "123 " string(4) " 123" string(4) " 123" string(4) " 123" string(30) " 123" string(4) "0-7]" string(1) "o" -- Iteration 16 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 17 -- string(22) "1777777777760000000000" string(1) "o" string(22) "1777777777760000000000" string(1) "o" string(23) " 1777777777760000000000" string(23) "1777777777760000000000 " string(23) " 1777777777760000000000" string(23) " 1777777777760000000000" string(22) "1777777777760000000000" string(30) " 1777777777760000000000" string(4) "0-7]" string(1) "o" -- Iteration 18 -- string(11) "17777777777" string(1) "o" string(11) "17777777777" string(1) "o" string(12) " 17777777777" string(12) "17777777777 " string(12) " 17777777777" string(12) " 17777777777" string(11) "17777777777" string(30) " 17777777777" string(4) "0-7]" string(1) "o" Done --UEXPECTF-- *** Testing sprintf() : octal formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 2 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 3 -- unicode(22) "1777777777777777777777" unicode(1) "o" unicode(22) "1777777777777777777777" unicode(1) "o" unicode(23) " 1777777777777777777777" unicode(23) "1777777777777777777777 " unicode(23) " 1777777777777777777777" unicode(23) " 1777777777777777777777" unicode(22) "1777777777777777777777" unicode(30) " 1777777777777777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 4 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 5 -- unicode(22) "1777777777760000000001" unicode(1) "o" unicode(22) "1777777777760000000001" unicode(1) "o" unicode(23) " 1777777777760000000001" unicode(23) "1777777777760000000001 " unicode(23) " 1777777777760000000001" unicode(23) " 1777777777760000000001" unicode(22) "1777777777760000000001" unicode(30) " 1777777777760000000001" unicode(4) "0-7]" unicode(1) "o" -- Iteration 6 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 7 -- unicode(11) "17777777770" unicode(1) "o" unicode(11) "17777777770" unicode(1) "o" unicode(12) " 17777777770" unicode(12) "17777777770 " unicode(12) " 17777777770" unicode(12) " 17777777770" unicode(11) "17777777770" unicode(30) " 17777777770" unicode(4) "0-7]" unicode(1) "o" -- Iteration 8 -- unicode(5) "11073" unicode(1) "o" unicode(5) "11073" unicode(1) "o" unicode(6) " 11073" unicode(6) "11073 " unicode(6) " 11073" unicode(6) " 11073" unicode(5) "11073" unicode(30) " 11073" unicode(4) "0-7]" unicode(1) "o" -- Iteration 9 -- unicode(5) "11253" unicode(1) "o" unicode(5) "11253" unicode(1) "o" unicode(6) " 11253" unicode(6) "11253 " unicode(6) " 11253" unicode(6) " 11253" unicode(5) "11253" unicode(30) " 11253" unicode(4) "0-7]" unicode(1) "o" -- Iteration 10 -- unicode(4) "7777" unicode(1) "o" unicode(4) "7777" unicode(1) "o" unicode(5) " 7777" unicode(5) "7777 " unicode(5) " 7777" unicode(5) " 7777" unicode(4) "7777" unicode(30) " 7777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 11 -- unicode(3) "372" unicode(1) "o" unicode(3) "372" unicode(1) "o" unicode(4) " 372" unicode(4) "372 " unicode(4) " 372" unicode(4) " 372" unicode(4) " 372" unicode(30) " 372" unicode(4) "0-7]" unicode(1) "o" -- Iteration 12 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 13 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 14 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" -- Iteration 15 -- unicode(3) "123" unicode(1) "o" unicode(3) "123" unicode(1) "o" unicode(4) " 123" unicode(4) "123 " unicode(4) " 123" unicode(4) " 123" unicode(4) " 123" unicode(30) " 123" unicode(4) "0-7]" unicode(1) "o" -- Iteration 16 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 17 -- unicode(22) "1777777777760000000000" unicode(1) "o" unicode(22) "1777777777760000000000" unicode(1) "o" unicode(23) " 1777777777760000000000" unicode(23) "1777777777760000000000 " unicode(23) " 1777777777760000000000" unicode(23) " 1777777777760000000000" unicode(22) "1777777777760000000000" unicode(30) " 1777777777760000000000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 18 -- unicode(11) "17777777777" unicode(1) "o" unicode(11) "17777777777" unicode(1) "o" unicode(12) " 17777777777" unicode(12) "17777777777 " unicode(12) " 17777777777" unicode(12) " 17777777777" unicode(11) "17777777777" unicode(30) " 17777777777" unicode(4) "0-7]" unicode(1) "o" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation29_64bit.phpt --TEST-- Test sprintf() function : usage variations - octal formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : octal formats with float values ***\n"; // array of float values $float_values = array( 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.5e+5 ); // array of octal formats $octal_formats = array( "%o", "%ho", "%lo", "%Lo", " %o", "%o ", "\t%o", "\n%o", "%4o", "%30o", "%[0-7]", "%*o" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($octal_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : octal formats with float values *** -- Iteration 1 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 2 -- string(1) "0" string(1) "o" string(1) "0" string(1) "o" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-7]" string(1) "o" -- Iteration 3 -- string(1) "1" string(1) "o" string(1) "1" string(1) "o" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-7]" string(1) "o" -- Iteration 4 -- string(6) "303240" string(1) "o" string(6) "303240" string(1) "o" string(7) " 303240" string(7) "303240 " string(7) " 303240" string(7) " 303240" string(6) "303240" string(30) " 303240" string(4) "0-7]" string(1) "o" -- Iteration 5 -- string(22) "1777777777777774136700" string(1) "o" string(22) "1777777777777774136700" string(1) "o" string(23) " 1777777777777774136700" string(23) "1777777777777774136700 " string(23) " 1777777777777774136700" string(23) " 1777777777777774136700" string(22) "1777777777777774136700" string(30) " 1777777777777774136700" string(4) "0-7]" string(1) "o" -- Iteration 6 -- string(9) "575360400" string(1) "o" string(9) "575360400" string(1) "o" string(10) " 575360400" string(10) "575360400 " string(10) " 575360400" string(10) " 575360400" string(9) "575360400" string(30) " 575360400" string(4) "0-7]" string(1) "o" -- Iteration 7 -- string(22) "1777777777770431233000" string(1) "o" string(22) "1777777777770431233000" string(1) "o" string(23) " 1777777777770431233000" string(23) "1777777777770431233000 " string(23) " 1777777777770431233000" string(23) " 1777777777770431233000" string(22) "1777777777770431233000" string(30) " 1777777777770431233000" string(4) "0-7]" string(1) "o" -- Iteration 8 -- string(7) "4002620" string(1) "o" string(7) "4002620" string(1) "o" string(8) " 4002620" string(8) "4002620 " string(8) " 4002620" string(8) " 4002620" string(7) "4002620" string(30) " 4002620" string(4) "0-7]" string(1) "o" Done --UEXPECTF-- *** Testing sprintf() : octal formats with float values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 2 -- unicode(1) "0" unicode(1) "o" unicode(1) "0" unicode(1) "o" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-7]" unicode(1) "o" -- Iteration 3 -- unicode(1) "1" unicode(1) "o" unicode(1) "1" unicode(1) "o" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-7]" unicode(1) "o" -- Iteration 4 -- unicode(6) "303240" unicode(1) "o" unicode(6) "303240" unicode(1) "o" unicode(7) " 303240" unicode(7) "303240 " unicode(7) " 303240" unicode(7) " 303240" unicode(6) "303240" unicode(30) " 303240" unicode(4) "0-7]" unicode(1) "o" -- Iteration 5 -- unicode(22) "1777777777777774136700" unicode(1) "o" unicode(22) "1777777777777774136700" unicode(1) "o" unicode(23) " 1777777777777774136700" unicode(23) "1777777777777774136700 " unicode(23) " 1777777777777774136700" unicode(23) " 1777777777777774136700" unicode(22) "1777777777777774136700" unicode(30) " 1777777777777774136700" unicode(4) "0-7]" unicode(1) "o" -- Iteration 6 -- unicode(9) "575360400" unicode(1) "o" unicode(9) "575360400" unicode(1) "o" unicode(10) " 575360400" unicode(10) "575360400 " unicode(10) " 575360400" unicode(10) " 575360400" unicode(9) "575360400" unicode(30) " 575360400" unicode(4) "0-7]" unicode(1) "o" -- Iteration 7 -- unicode(22) "1777777777770431233000" unicode(1) "o" unicode(22) "1777777777770431233000" unicode(1) "o" unicode(23) " 1777777777770431233000" unicode(23) "1777777777770431233000 " unicode(23) " 1777777777770431233000" unicode(23) " 1777777777770431233000" unicode(22) "1777777777770431233000" unicode(30) " 1777777777770431233000" unicode(4) "0-7]" unicode(1) "o" -- Iteration 8 -- unicode(7) "4002620" unicode(1) "o" unicode(7) "4002620" unicode(1) "o" unicode(8) " 4002620" unicode(8) "4002620 " unicode(8) " 4002620" unicode(8) " 4002620" unicode(7) "4002620" unicode(30) " 4002620" unicode(4) "0-7]" unicode(1) "o" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation34_64bit.phpt --TEST-- Test sprintf() function : usage variations - hexa formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : hexa formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value 2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($hexa_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : hexa formats with integer values *** -- Iteration 1 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 2 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 3 -- string(16) "ffffffffffffffff" string(17) "ffffffffffffffffx" string(16) "ffffffffffffffff" string(1) "x" string(17) " ffffffffffffffff" string(17) "ffffffffffffffff " string(17) " ffffffffffffffff" string(17) " ffffffffffffffff" string(16) "ffffffffffffffff" string(30) " ffffffffffffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 4 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 5 -- string(16) "ffffffff80000001" string(17) "ffffffff80000001x" string(16) "ffffffff80000001" string(1) "x" string(17) " ffffffff80000001" string(17) "ffffffff80000001 " string(17) " ffffffff80000001" string(17) " ffffffff80000001" string(16) "ffffffff80000001" string(30) " ffffffff80000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 6 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 7 -- string(8) "7ffffff8" string(9) "7ffffff8x" string(8) "7ffffff8" string(1) "x" string(9) " 7ffffff8" string(9) "7ffffff8 " string(9) " 7ffffff8" string(9) " 7ffffff8" string(8) "7ffffff8" string(30) " 7ffffff8" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 8 -- string(4) "123b" string(5) "123bx" string(4) "123b" string(1) "x" string(5) " 123b" string(5) "123b " string(5) " 123b" string(5) " 123b" string(4) "123b" string(30) " 123b" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 9 -- string(4) "12ab" string(5) "12abx" string(4) "12ab" string(1) "x" string(5) " 12ab" string(5) "12ab " string(5) " 12ab" string(5) " 12ab" string(4) "12ab" string(30) " 12ab" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 10 -- string(3) "fff" string(4) "fffx" string(3) "fff" string(1) "x" string(4) " fff" string(4) "fff " string(4) " fff" string(4) " fff" string(4) " fff" string(30) " fff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 11 -- string(2) "fa" string(3) "fax" string(2) "fa" string(1) "x" string(3) " fa" string(3) "fa " string(3) " fa" string(3) " fa" string(4) " fa" string(30) " fa" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 12 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 13 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 14 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 15 -- string(2) "53" string(3) "53x" string(2) "53" string(1) "x" string(3) " 53" string(3) "53 " string(3) " 53" string(3) " 53" string(4) " 53" string(30) " 53" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 16 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 17 -- string(16) "ffffffff80000000" string(17) "ffffffff80000000x" string(16) "ffffffff80000000" string(1) "x" string(17) " ffffffff80000000" string(17) "ffffffff80000000 " string(17) " ffffffff80000000" string(17) " ffffffff80000000" string(16) "ffffffff80000000" string(30) " ffffffff80000000" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 18 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" Done --UEXPECTF-- *** Testing sprintf() : hexa formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 2 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 3 -- unicode(16) "ffffffffffffffff" unicode(17) "ffffffffffffffffx" unicode(16) "ffffffffffffffff" unicode(1) "x" unicode(17) " ffffffffffffffff" unicode(17) "ffffffffffffffff " unicode(17) " ffffffffffffffff" unicode(17) " ffffffffffffffff" unicode(16) "ffffffffffffffff" unicode(30) " ffffffffffffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 4 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 5 -- unicode(16) "ffffffff80000001" unicode(17) "ffffffff80000001x" unicode(16) "ffffffff80000001" unicode(1) "x" unicode(17) " ffffffff80000001" unicode(17) "ffffffff80000001 " unicode(17) " ffffffff80000001" unicode(17) " ffffffff80000001" unicode(16) "ffffffff80000001" unicode(30) " ffffffff80000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 6 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 7 -- unicode(8) "7ffffff8" unicode(9) "7ffffff8x" unicode(8) "7ffffff8" unicode(1) "x" unicode(9) " 7ffffff8" unicode(9) "7ffffff8 " unicode(9) " 7ffffff8" unicode(9) " 7ffffff8" unicode(8) "7ffffff8" unicode(30) " 7ffffff8" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 8 -- unicode(4) "123b" unicode(5) "123bx" unicode(4) "123b" unicode(1) "x" unicode(5) " 123b" unicode(5) "123b " unicode(5) " 123b" unicode(5) " 123b" unicode(4) "123b" unicode(30) " 123b" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 9 -- unicode(4) "12ab" unicode(5) "12abx" unicode(4) "12ab" unicode(1) "x" unicode(5) " 12ab" unicode(5) "12ab " unicode(5) " 12ab" unicode(5) " 12ab" unicode(4) "12ab" unicode(30) " 12ab" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 10 -- unicode(3) "fff" unicode(4) "fffx" unicode(3) "fff" unicode(1) "x" unicode(4) " fff" unicode(4) "fff " unicode(4) " fff" unicode(4) " fff" unicode(4) " fff" unicode(30) " fff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 11 -- unicode(2) "fa" unicode(3) "fax" unicode(2) "fa" unicode(1) "x" unicode(3) " fa" unicode(3) "fa " unicode(3) " fa" unicode(3) " fa" unicode(4) " fa" unicode(30) " fa" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 12 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 13 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 14 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 15 -- unicode(2) "53" unicode(3) "53x" unicode(2) "53" unicode(1) "x" unicode(3) " 53" unicode(3) "53 " unicode(3) " 53" unicode(3) " 53" unicode(4) " 53" unicode(30) " 53" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 16 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 17 -- unicode(16) "ffffffff80000000" unicode(17) "ffffffff80000000x" unicode(16) "ffffffff80000000" unicode(1) "x" unicode(17) " ffffffff80000000" unicode(17) "ffffffff80000000 " unicode(17) " ffffffff80000000" unicode(17) " ffffffff80000000" unicode(16) "ffffffff80000000" unicode(30) " ffffffff80000000" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 18 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation35_64bit.phpt --TEST-- Test sprintf() function : usage variations - hexa formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : hexa formats with float values ***\n"; // array of float values $float_values = array( 2147483647, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // array of hexa formats $hexa_formats = array( "%x", "%xx", "%lx", "%Lx", " %x", "%x ", "\t%x", "\n%x", "%4x", "%30x", "%[0-9A-Fa-f]", "%*x" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($hexa_formats as $format) { // with two arguments var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : hexa formats with float values *** -- Iteration 1 -- string(8) "7fffffff" string(9) "7fffffffx" string(8) "7fffffff" string(1) "x" string(9) " 7fffffff" string(9) "7fffffff " string(9) " 7fffffff" string(9) " 7fffffff" string(8) "7fffffff" string(30) " 7fffffff" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 2 -- string(9) "800000001" string(10) "800000001x" string(9) "800000001" string(1) "x" string(10) " 800000001" string(10) "800000001 " string(10) " 800000001" string(10) " 800000001" string(9) "800000001" string(30) " 800000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 3 -- string(8) "80000001" string(9) "80000001x" string(8) "80000001" string(1) "x" string(9) " 80000001" string(9) "80000001 " string(9) " 80000001" string(9) " 80000001" string(8) "80000001" string(30) " 80000001" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 4 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 5 -- string(1) "0" string(2) "0x" string(1) "0" string(1) "x" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 6 -- string(1) "1" string(2) "1x" string(1) "1" string(1) "x" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 7 -- string(5) "186a0" string(6) "186a0x" string(5) "186a0" string(1) "x" string(6) " 186a0" string(6) "186a0 " string(6) " 186a0" string(6) " 186a0" string(5) "186a0" string(30) " 186a0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 8 -- string(16) "fffffffffff0bdc0" string(17) "fffffffffff0bdc0x" string(16) "fffffffffff0bdc0" string(1) "x" string(17) " fffffffffff0bdc0" string(17) "fffffffffff0bdc0 " string(17) " fffffffffff0bdc0" string(17) " fffffffffff0bdc0" string(16) "fffffffffff0bdc0" string(30) " fffffffffff0bdc0" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 9 -- string(7) "5f5e100" string(8) "5f5e100x" string(7) "5f5e100" string(1) "x" string(8) " 5f5e100" string(8) "5f5e100 " string(8) " 5f5e100" string(8) " 5f5e100" string(7) "5f5e100" string(30) " 5f5e100" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 10 -- string(16) "ffffffffc4653600" string(17) "ffffffffc4653600x" string(16) "ffffffffc4653600" string(1) "x" string(17) " ffffffffc4653600" string(17) "ffffffffc4653600 " string(17) " ffffffffc4653600" string(17) " ffffffffc4653600" string(16) "ffffffffc4653600" string(30) " ffffffffc4653600" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 11 -- string(1) "a" string(2) "ax" string(1) "a" string(1) "x" string(2) " a" string(2) "a " string(2) " a" string(2) " a" string(4) " a" string(30) " a" string(10) "0-9A-Fa-f]" string(1) "x" -- Iteration 12 -- string(6) "100590" string(7) "100590x" string(6) "100590" string(1) "x" string(7) " 100590" string(7) "100590 " string(7) " 100590" string(7) " 100590" string(6) "100590" string(30) " 100590" string(10) "0-9A-Fa-f]" string(1) "x" Done --UEXPECTF-- *** Testing sprintf() : hexa formats with float values *** -- Iteration 1 -- unicode(8) "7fffffff" unicode(9) "7fffffffx" unicode(8) "7fffffff" unicode(1) "x" unicode(9) " 7fffffff" unicode(9) "7fffffff " unicode(9) " 7fffffff" unicode(9) " 7fffffff" unicode(8) "7fffffff" unicode(30) " 7fffffff" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 2 -- unicode(9) "800000001" unicode(10) "800000001x" unicode(9) "800000001" unicode(1) "x" unicode(10) " 800000001" unicode(10) "800000001 " unicode(10) " 800000001" unicode(10) " 800000001" unicode(9) "800000001" unicode(30) " 800000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 3 -- unicode(8) "80000001" unicode(9) "80000001x" unicode(8) "80000001" unicode(1) "x" unicode(9) " 80000001" unicode(9) "80000001 " unicode(9) " 80000001" unicode(9) " 80000001" unicode(8) "80000001" unicode(30) " 80000001" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 4 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 5 -- unicode(1) "0" unicode(2) "0x" unicode(1) "0" unicode(1) "x" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 6 -- unicode(1) "1" unicode(2) "1x" unicode(1) "1" unicode(1) "x" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 7 -- unicode(5) "186a0" unicode(6) "186a0x" unicode(5) "186a0" unicode(1) "x" unicode(6) " 186a0" unicode(6) "186a0 " unicode(6) " 186a0" unicode(6) " 186a0" unicode(5) "186a0" unicode(30) " 186a0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 8 -- unicode(16) "fffffffffff0bdc0" unicode(17) "fffffffffff0bdc0x" unicode(16) "fffffffffff0bdc0" unicode(1) "x" unicode(17) " fffffffffff0bdc0" unicode(17) "fffffffffff0bdc0 " unicode(17) " fffffffffff0bdc0" unicode(17) " fffffffffff0bdc0" unicode(16) "fffffffffff0bdc0" unicode(30) " fffffffffff0bdc0" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 9 -- unicode(7) "5f5e100" unicode(8) "5f5e100x" unicode(7) "5f5e100" unicode(1) "x" unicode(8) " 5f5e100" unicode(8) "5f5e100 " unicode(8) " 5f5e100" unicode(8) " 5f5e100" unicode(7) "5f5e100" unicode(30) " 5f5e100" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 10 -- unicode(16) "ffffffffc4653600" unicode(17) "ffffffffc4653600x" unicode(16) "ffffffffc4653600" unicode(1) "x" unicode(17) " ffffffffc4653600" unicode(17) "ffffffffc4653600 " unicode(17) " ffffffffc4653600" unicode(17) " ffffffffc4653600" unicode(16) "ffffffffc4653600" unicode(30) " ffffffffc4653600" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 11 -- unicode(1) "a" unicode(2) "ax" unicode(1) "a" unicode(1) "x" unicode(2) " a" unicode(2) "a " unicode(2) " a" unicode(2) " a" unicode(4) " a" unicode(30) " a" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 12 -- unicode(6) "100590" unicode(7) "100590x" unicode(6) "100590" unicode(1) "x" unicode(7) " 100590" unicode(7) "100590 " unicode(7) " 100590" unicode(7) " 100590" unicode(6) "100590" unicode(30) " 100590" unicode(10) "0-9A-Fa-f]" unicode(1) "x" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation40_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with integer values ***\n"; // array of integer values $integer_values = array( 0, 1, -1, -2147483648, // max negative integer value -2147483647, 2147483647, // max positive integer value +2147483640, 0x123B, // integer as hexadecimal 0x12ab, 0Xfff, 0XFA, -0x80000000, // max negative integer as hexadecimal 0x7fffffff, // max postive integer as hexadecimal 0x7FFFFFFF, // max postive integer as hexadecimal 0123, // integer as octal 01912, // should be quivalent to octal 1 -020000000000, // max negative integer as octal 017777777777 // max positive integer as octal ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($integer_values as $integer_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $integer_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with integer values *** -- Iteration 1 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(20) "18446744073709551615" string(1) "u" string(20) "18446744073709551615" string(1) "u" string(21) " 18446744073709551615" string(21) "18446744073709551615 " string(21) " 18446744073709551615" string(21) " 18446744073709551615" string(20) "18446744073709551615" string(30) " 18446744073709551615" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(20) "18446744071562067969" string(1) "u" string(20) "18446744071562067969" string(1) "u" string(21) " 18446744071562067969" string(21) "18446744071562067969 " string(21) " 18446744071562067969" string(21) " 18446744071562067969" string(20) "18446744071562067969" string(30) " 18446744071562067969" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(10) "2147483640" string(1) "u" string(10) "2147483640" string(1) "u" string(11) " 2147483640" string(11) "2147483640 " string(11) " 2147483640" string(11) " 2147483640" string(10) "2147483640" string(30) " 2147483640" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(4) "4667" string(1) "u" string(4) "4667" string(1) "u" string(5) " 4667" string(5) "4667 " string(5) " 4667" string(5) " 4667" string(4) "4667" string(30) " 4667" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(4) "4779" string(1) "u" string(4) "4779" string(1) "u" string(5) " 4779" string(5) "4779 " string(5) " 4779" string(5) " 4779" string(4) "4779" string(30) " 4779" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(4) "4095" string(1) "u" string(4) "4095" string(1) "u" string(5) " 4095" string(5) "4095 " string(5) " 4095" string(5) " 4095" string(4) "4095" string(30) " 4095" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(3) "250" string(1) "u" string(3) "250" string(1) "u" string(4) " 250" string(4) "250 " string(4) " 250" string(4) " 250" string(4) " 250" string(30) " 250" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(2) "83" string(1) "u" string(2) "83" string(1) "u" string(3) " 83" string(3) "83 " string(3) " 83" string(3) " 83" string(4) " 83" string(30) " 83" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(20) "18446744071562067968" string(1) "u" string(20) "18446744071562067968" string(1) "u" string(21) " 18446744071562067968" string(21) "18446744071562067968 " string(21) " 18446744071562067968" string(21) " 18446744071562067968" string(20) "18446744071562067968" string(30) " 18446744071562067968" string(4) "0-9]" string(1) "u" -- Iteration 18 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with integer values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(20) "18446744073709551615" unicode(1) "u" unicode(20) "18446744073709551615" unicode(1) "u" unicode(21) " 18446744073709551615" unicode(21) "18446744073709551615 " unicode(21) " 18446744073709551615" unicode(21) " 18446744073709551615" unicode(20) "18446744073709551615" unicode(30) " 18446744073709551615" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(20) "18446744071562067969" unicode(1) "u" unicode(20) "18446744071562067969" unicode(1) "u" unicode(21) " 18446744071562067969" unicode(21) "18446744071562067969 " unicode(21) " 18446744071562067969" unicode(21) " 18446744071562067969" unicode(20) "18446744071562067969" unicode(30) " 18446744071562067969" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(10) "2147483640" unicode(1) "u" unicode(10) "2147483640" unicode(1) "u" unicode(11) " 2147483640" unicode(11) "2147483640 " unicode(11) " 2147483640" unicode(11) " 2147483640" unicode(10) "2147483640" unicode(30) " 2147483640" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(4) "4667" unicode(1) "u" unicode(4) "4667" unicode(1) "u" unicode(5) " 4667" unicode(5) "4667 " unicode(5) " 4667" unicode(5) " 4667" unicode(4) "4667" unicode(30) " 4667" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(4) "4779" unicode(1) "u" unicode(4) "4779" unicode(1) "u" unicode(5) " 4779" unicode(5) "4779 " unicode(5) " 4779" unicode(5) " 4779" unicode(4) "4779" unicode(30) " 4779" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(4) "4095" unicode(1) "u" unicode(4) "4095" unicode(1) "u" unicode(5) " 4095" unicode(5) "4095 " unicode(5) " 4095" unicode(5) " 4095" unicode(4) "4095" unicode(30) " 4095" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(3) "250" unicode(1) "u" unicode(3) "250" unicode(1) "u" unicode(4) " 250" unicode(4) "250 " unicode(4) " 250" unicode(4) " 250" unicode(4) " 250" unicode(30) " 250" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(2) "83" unicode(1) "u" unicode(2) "83" unicode(1) "u" unicode(3) " 83" unicode(3) "83 " unicode(3) " 83" unicode(3) " 83" unicode(4) " 83" unicode(30) " 83" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(20) "18446744071562067968" unicode(1) "u" unicode(20) "18446744071562067968" unicode(1) "u" unicode(21) " 18446744071562067968" unicode(21) "18446744071562067968 " unicode(21) " 18446744071562067968" unicode(21) " 18446744071562067968" unicode(20) "18446744071562067968" unicode(30) " 18446744071562067968" unicode(4) "0-9]" unicode(1) "u" -- Iteration 18 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation41_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with float values ***\n"; // array of float values $float_values = array( 2147483647, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, +1e5, +5e+5, +0e-5, -1e5, -1e+5, -1e-2, 1e5, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with float values *** -- Iteration 1 -- string(10) "2147483647" string(1) "u" string(10) "2147483647" string(1) "u" string(11) " 2147483647" string(11) "2147483647 " string(11) " 2147483647" string(11) " 2147483647" string(10) "2147483647" string(30) " 2147483647" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(11) "34359738369" string(1) "u" string(11) "34359738369" string(1) "u" string(12) " 34359738369" string(12) "34359738369 " string(12) " 34359738369" string(12) " 34359738369" string(11) "34359738369" string(30) " 34359738369" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(10) "2147483649" string(1) "u" string(10) "2147483649" string(1) "u" string(11) " 2147483649" string(11) "2147483649 " string(11) " 2147483649" string(11) " 2147483649" string(10) "2147483649" string(30) " 2147483649" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(6) "100000" string(1) "u" string(6) "100000" string(1) "u" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(6) "500000" string(1) "u" string(6) "500000" string(1) "u" string(7) " 500000" string(7) "500000 " string(7) " 500000" string(7) " 500000" string(6) "500000" string(30) " 500000" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(20) "18446744073709451616" string(1) "u" string(20) "18446744073709451616" string(1) "u" string(21) " 18446744073709451616" string(21) "18446744073709451616 " string(21) " 18446744073709451616" string(21) " 18446744073709451616" string(20) "18446744073709451616" string(30) " 18446744073709451616" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(20) "18446744073709451616" string(1) "u" string(20) "18446744073709451616" string(1) "u" string(21) " 18446744073709451616" string(21) "18446744073709451616 " string(21) " 18446744073709451616" string(21) " 18446744073709451616" string(20) "18446744073709451616" string(30) " 18446744073709451616" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(6) "100000" string(1) "u" string(6) "100000" string(1) "u" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(9) "100000000" string(1) "u" string(9) "100000000" string(1) "u" string(10) " 100000000" string(10) "100000000 " string(10) " 100000000" string(10) " 100000000" string(9) "100000000" string(30) " 100000000" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(20) "18446744072709551616" string(1) "u" string(20) "18446744072709551616" string(1) "u" string(21) " 18446744072709551616" string(21) "18446744072709551616 " string(21) " 18446744072709551616" string(21) " 18446744072709551616" string(20) "18446744072709551616" string(30) " 18446744072709551616" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(2) "10" string(1) "u" string(2) "10" string(1) "u" string(3) " 10" string(3) "10 " string(3) " 10" string(3) " 10" string(4) " 10" string(30) " 10" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(7) "1050000" string(1) "u" string(7) "1050000" string(1) "u" string(8) " 1050000" string(8) "1050000 " string(8) " 1050000" string(8) " 1050000" string(7) "1050000" string(30) " 1050000" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with float values *** -- Iteration 1 -- unicode(10) "2147483647" unicode(1) "u" unicode(10) "2147483647" unicode(1) "u" unicode(11) " 2147483647" unicode(11) "2147483647 " unicode(11) " 2147483647" unicode(11) " 2147483647" unicode(10) "2147483647" unicode(30) " 2147483647" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(11) "34359738369" unicode(1) "u" unicode(11) "34359738369" unicode(1) "u" unicode(12) " 34359738369" unicode(12) "34359738369 " unicode(12) " 34359738369" unicode(12) " 34359738369" unicode(11) "34359738369" unicode(30) " 34359738369" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(10) "2147483649" unicode(1) "u" unicode(10) "2147483649" unicode(1) "u" unicode(11) " 2147483649" unicode(11) "2147483649 " unicode(11) " 2147483649" unicode(11) " 2147483649" unicode(10) "2147483649" unicode(30) " 2147483649" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(6) "100000" unicode(1) "u" unicode(6) "100000" unicode(1) "u" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(6) "500000" unicode(1) "u" unicode(6) "500000" unicode(1) "u" unicode(7) " 500000" unicode(7) "500000 " unicode(7) " 500000" unicode(7) " 500000" unicode(6) "500000" unicode(30) " 500000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(20) "18446744073709451616" unicode(1) "u" unicode(20) "18446744073709451616" unicode(1) "u" unicode(21) " 18446744073709451616" unicode(21) "18446744073709451616 " unicode(21) " 18446744073709451616" unicode(21) " 18446744073709451616" unicode(20) "18446744073709451616" unicode(30) " 18446744073709451616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(20) "18446744073709451616" unicode(1) "u" unicode(20) "18446744073709451616" unicode(1) "u" unicode(21) " 18446744073709451616" unicode(21) "18446744073709451616 " unicode(21) " 18446744073709451616" unicode(21) " 18446744073709451616" unicode(20) "18446744073709451616" unicode(30) " 18446744073709451616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(6) "100000" unicode(1) "u" unicode(6) "100000" unicode(1) "u" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(9) "100000000" unicode(1) "u" unicode(9) "100000000" unicode(1) "u" unicode(10) " 100000000" unicode(10) "100000000 " unicode(10) " 100000000" unicode(10) " 100000000" unicode(9) "100000000" unicode(30) " 100000000" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(20) "18446744072709551616" unicode(1) "u" unicode(20) "18446744072709551616" unicode(1) "u" unicode(21) " 18446744072709551616" unicode(21) "18446744072709551616 " unicode(21) " 18446744072709551616" unicode(21) " 18446744072709551616" unicode(20) "18446744072709551616" unicode(30) " 18446744072709551616" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(2) "10" unicode(1) "u" unicode(2) "10" unicode(1) "u" unicode(3) " 10" unicode(3) "10 " unicode(3) " 10" unicode(3) " 10" unicode(4) " 10" unicode(30) " 10" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(7) "1050000" unicode(1) "u" unicode(7) "1050000" unicode(1) "u" unicode(8) " 1050000" unicode(8) "1050000 " unicode(8) " 1050000" unicode(8) " 1050000" unicode(7) "1050000" unicode(30) " 1050000" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation44_64bit.phpt --TEST-- Test sprintf() function : usage variations - unsigned formats with string values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : unsigned formats with string values ***\n"; // array of string values $string_values = array( "", '', "0", '0', "1", '1', "-123", "+123", "\x01", '\x01', "\01", '\01', 'string', "string", "true", "FALSE", 'false', 'TRUE', "NULL", 'null' ); // array of unsigned formats $unsigned_formats = array( "%u", "%hu", "%lu", "%Lu", " %u", "%u ", "\t%u", "\n%u", "%4u", "%30u", "%[0-9]", "%*u" ); $count = 1; foreach($string_values as $string_value) { echo "\n-- Iteration $count --\n"; foreach($unsigned_formats as $format) { var_dump( sprintf($format, $string_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : unsigned formats with string values *** -- Iteration 1 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 2 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 3 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 4 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 5 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 6 -- string(1) "1" string(1) "u" string(1) "1" string(1) "u" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "u" -- Iteration 7 -- string(20) "18446744073709551493" string(1) "u" string(20) "18446744073709551493" string(1) "u" string(21) " 18446744073709551493" string(21) "18446744073709551493 " string(21) " 18446744073709551493" string(21) " 18446744073709551493" string(20) "18446744073709551493" string(30) " 18446744073709551493" string(4) "0-9]" string(1) "u" -- Iteration 8 -- string(3) "123" string(1) "u" string(3) "123" string(1) "u" string(4) " 123" string(4) "123 " string(4) " 123" string(4) " 123" string(4) " 123" string(30) " 123" string(4) "0-9]" string(1) "u" -- Iteration 9 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 10 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 11 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 12 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 13 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 14 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 15 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 16 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 17 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 18 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 19 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" -- Iteration 20 -- string(1) "0" string(1) "u" string(1) "0" string(1) "u" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "u" Done --UEXPECTF-- *** Testing sprintf() : unsigned formats with string values *** -- Iteration 1 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 2 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 3 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 4 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 5 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 6 -- unicode(1) "1" unicode(1) "u" unicode(1) "1" unicode(1) "u" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "u" -- Iteration 7 -- unicode(20) "18446744073709551493" unicode(1) "u" unicode(20) "18446744073709551493" unicode(1) "u" unicode(21) " 18446744073709551493" unicode(21) "18446744073709551493 " unicode(21) " 18446744073709551493" unicode(21) " 18446744073709551493" unicode(20) "18446744073709551493" unicode(30) " 18446744073709551493" unicode(4) "0-9]" unicode(1) "u" -- Iteration 8 -- unicode(3) "123" unicode(1) "u" unicode(3) "123" unicode(1) "u" unicode(4) " 123" unicode(4) "123 " unicode(4) " 123" unicode(4) " 123" unicode(4) " 123" unicode(30) " 123" unicode(4) "0-9]" unicode(1) "u" -- Iteration 9 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 10 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 11 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 12 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 13 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 14 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 15 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 16 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 17 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 18 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 19 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" -- Iteration 20 -- unicode(1) "0" unicode(1) "u" unicode(1) "0" unicode(1) "u" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "u" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt +++ php-src/ext/standard/tests/strings/sprintf_variation4_64bit.phpt --TEST-- Test sprintf() function : usage variations - int formats with float values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string sprintf(string $format [, mixed $arg1 [, mixed ...]]) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing sprintf() : integer formats with float values ***\n"; // array of float type values $float_values = array ( 2147483648, 0x800000001, // float value, beyond max positive int 020000000001, // float value, beyond max positive int 0.0, -0.1, 1.0, 1e5, -1e6, 1E8, -1E9, 10.0000000000000000005, 10.5e+5 ); // various integer formats $int_formats = array( "%d", "%hd", "%ld", "%Ld", " %d", "%d ", "\t%d", "\n%d", "%4d", "%30d", "%[0-9]", "%*d" ); $count = 1; foreach($float_values as $float_value) { echo "\n-- Iteration $count --\n"; foreach($int_formats as $format) { var_dump( sprintf($format, $float_value) ); } $count++; }; echo "Done"; ?> --EXPECTF-- *** Testing sprintf() : integer formats with float values *** -- Iteration 1 -- string(10) "2147483648" string(1) "d" string(10) "2147483648" string(1) "d" string(11) " 2147483648" string(11) "2147483648 " string(11) " 2147483648" string(11) " 2147483648" string(10) "2147483648" string(30) " 2147483648" string(4) "0-9]" string(1) "d" -- Iteration 2 -- string(11) "34359738369" string(1) "d" string(11) "34359738369" string(1) "d" string(12) " 34359738369" string(12) "34359738369 " string(12) " 34359738369" string(12) " 34359738369" string(11) "34359738369" string(30) " 34359738369" string(4) "0-9]" string(1) "d" -- Iteration 3 -- string(10) "2147483649" string(1) "d" string(10) "2147483649" string(1) "d" string(11) " 2147483649" string(11) "2147483649 " string(11) " 2147483649" string(11) " 2147483649" string(10) "2147483649" string(30) " 2147483649" string(4) "0-9]" string(1) "d" -- Iteration 4 -- string(1) "0" string(1) "d" string(1) "0" string(1) "d" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "d" -- Iteration 5 -- string(1) "0" string(1) "d" string(1) "0" string(1) "d" string(2) " 0" string(2) "0 " string(2) " 0" string(2) " 0" string(4) " 0" string(30) " 0" string(4) "0-9]" string(1) "d" -- Iteration 6 -- string(1) "1" string(1) "d" string(1) "1" string(1) "d" string(2) " 1" string(2) "1 " string(2) " 1" string(2) " 1" string(4) " 1" string(30) " 1" string(4) "0-9]" string(1) "d" -- Iteration 7 -- string(6) "100000" string(1) "d" string(6) "100000" string(1) "d" string(7) " 100000" string(7) "100000 " string(7) " 100000" string(7) " 100000" string(6) "100000" string(30) " 100000" string(4) "0-9]" string(1) "d" -- Iteration 8 -- string(8) "-1000000" string(1) "d" string(8) "-1000000" string(1) "d" string(9) " -1000000" string(9) "-1000000 " string(9) " -1000000" string(9) " -1000000" string(8) "-1000000" string(30) " -1000000" string(4) "0-9]" string(1) "d" -- Iteration 9 -- string(9) "100000000" string(1) "d" string(9) "100000000" string(1) "d" string(10) " 100000000" string(10) "100000000 " string(10) " 100000000" string(10) " 100000000" string(9) "100000000" string(30) " 100000000" string(4) "0-9]" string(1) "d" -- Iteration 10 -- string(11) "-1000000000" string(1) "d" string(11) "-1000000000" string(1) "d" string(12) " -1000000000" string(12) "-1000000000 " string(12) " -1000000000" string(12) " -1000000000" string(11) "-1000000000" string(30) " -1000000000" string(4) "0-9]" string(1) "d" -- Iteration 11 -- string(2) "10" string(1) "d" string(2) "10" string(1) "d" string(3) " 10" string(3) "10 " string(3) " 10" string(3) " 10" string(4) " 10" string(30) " 10" string(4) "0-9]" string(1) "d" -- Iteration 12 -- string(7) "1050000" string(1) "d" string(7) "1050000" string(1) "d" string(8) " 1050000" string(8) "1050000 " string(8) " 1050000" string(8) " 1050000" string(7) "1050000" string(30) " 1050000" string(4) "0-9]" string(1) "d" Done --UEXPECTF-- *** Testing sprintf() : integer formats with float values *** -- Iteration 1 -- unicode(10) "2147483648" unicode(1) "d" unicode(10) "2147483648" unicode(1) "d" unicode(11) " 2147483648" unicode(11) "2147483648 " unicode(11) " 2147483648" unicode(11) " 2147483648" unicode(10) "2147483648" unicode(30) " 2147483648" unicode(4) "0-9]" unicode(1) "d" -- Iteration 2 -- unicode(11) "34359738369" unicode(1) "d" unicode(11) "34359738369" unicode(1) "d" unicode(12) " 34359738369" unicode(12) "34359738369 " unicode(12) " 34359738369" unicode(12) " 34359738369" unicode(11) "34359738369" unicode(30) " 34359738369" unicode(4) "0-9]" unicode(1) "d" -- Iteration 3 -- unicode(10) "2147483649" unicode(1) "d" unicode(10) "2147483649" unicode(1) "d" unicode(11) " 2147483649" unicode(11) "2147483649 " unicode(11) " 2147483649" unicode(11) " 2147483649" unicode(10) "2147483649" unicode(30) " 2147483649" unicode(4) "0-9]" unicode(1) "d" -- Iteration 4 -- unicode(1) "0" unicode(1) "d" unicode(1) "0" unicode(1) "d" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "d" -- Iteration 5 -- unicode(1) "0" unicode(1) "d" unicode(1) "0" unicode(1) "d" unicode(2) " 0" unicode(2) "0 " unicode(2) " 0" unicode(2) " 0" unicode(4) " 0" unicode(30) " 0" unicode(4) "0-9]" unicode(1) "d" -- Iteration 6 -- unicode(1) "1" unicode(1) "d" unicode(1) "1" unicode(1) "d" unicode(2) " 1" unicode(2) "1 " unicode(2) " 1" unicode(2) " 1" unicode(4) " 1" unicode(30) " 1" unicode(4) "0-9]" unicode(1) "d" -- Iteration 7 -- unicode(6) "100000" unicode(1) "d" unicode(6) "100000" unicode(1) "d" unicode(7) " 100000" unicode(7) "100000 " unicode(7) " 100000" unicode(7) " 100000" unicode(6) "100000" unicode(30) " 100000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 8 -- unicode(8) "-1000000" unicode(1) "d" unicode(8) "-1000000" unicode(1) "d" unicode(9) " -1000000" unicode(9) "-1000000 " unicode(9) " -1000000" unicode(9) " -1000000" unicode(8) "-1000000" unicode(30) " -1000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 9 -- unicode(9) "100000000" unicode(1) "d" unicode(9) "100000000" unicode(1) "d" unicode(10) " 100000000" unicode(10) "100000000 " unicode(10) " 100000000" unicode(10) " 100000000" unicode(9) "100000000" unicode(30) " 100000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 10 -- unicode(11) "-1000000000" unicode(1) "d" unicode(11) "-1000000000" unicode(1) "d" unicode(12) " -1000000000" unicode(12) "-1000000000 " unicode(12) " -1000000000" unicode(12) " -1000000000" unicode(11) "-1000000000" unicode(30) " -1000000000" unicode(4) "0-9]" unicode(1) "d" -- Iteration 11 -- unicode(2) "10" unicode(1) "d" unicode(2) "10" unicode(1) "d" unicode(3) " 10" unicode(3) "10 " unicode(3) " 10" unicode(3) " 10" unicode(4) " 10" unicode(30) " 10" unicode(4) "0-9]" unicode(1) "d" -- Iteration 12 -- unicode(7) "1050000" unicode(1) "d" unicode(7) "1050000" unicode(1) "d" unicode(8) " 1050000" unicode(8) "1050000 " unicode(8) " 1050000" unicode(8) " 1050000" unicode(7) "1050000" unicode(30) " 1050000" unicode(4) "0-9]" unicode(1) "d" Done