tony2001 Tue Nov 6 12:54:28 2007 UTC Added files: (Branch: PHP_5_3) /php-src/ext/standard/tests/strings vsprintf_basic7_64bit.phpt vsprintf_variation11_64bit.phpt vsprintf_variation12_64bit.phpt vsprintf_variation13_64bit.phpt vsprintf_variation14_64bit.phpt vsprintf_variation15_64bit.phpt vsprintf_variation16_64bit.phpt vsprintf_variation19_64bit.phpt vsprintf_variation4_64bit.phpt
Modified files: /php-src/ext/standard/tests/strings vsprintf_basic7.phpt vsprintf_variation11.phpt vsprintf_variation12.phpt vsprintf_variation13.phpt vsprintf_variation14.phpt vsprintf_variation15.phpt vsprintf_variation16.phpt vsprintf_variation19.phpt vsprintf_variation4.phpt Log: MFH: fix tests, add 64bit versions
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_basic7.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_basic7.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_basic7.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_basic7.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_basic7.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_basic7.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : basic functionality - unsigned format +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string $format , aaray $args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation11.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation11.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation11.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation11.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation11.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation11.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - octal formats with octal values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation12.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation12.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation12.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation12.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation12.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation12.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation13.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation13.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation13.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation13.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation13.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation13.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation14.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation14.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation14.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation14.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation14.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation14.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation15.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation15.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation15.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation15.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation15.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation15.phpt Tue Nov 6 12:54:27 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation16.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation16.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation16.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation16.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation16.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation16.phpt Tue Nov 6 12:54:28 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation19.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation19.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation19.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation19.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation19.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation19.phpt Tue Nov 6 12:54:28 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string $format , array $args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation4.phpt?r1=1.1.4.2&r2=1.1.4.3&diff_format=u Index: php-src/ext/standard/tests/strings/vsprintf_variation4.phpt diff -u php-src/ext/standard/tests/strings/vsprintf_variation4.phpt:1.1.4.2 php-src/ext/standard/tests/strings/vsprintf_variation4.phpt:1.1.4.3 --- php-src/ext/standard/tests/strings/vsprintf_variation4.phpt:1.1.4.2 Fri Oct 5 18:09:31 2007 +++ php-src/ext/standard/tests/strings/vsprintf_variation4.phpt Tue Nov 6 12:54:28 2007 @@ -1,5 +1,9 @@ --TEST-- Test vsprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- +<?php +if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only"); +?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_basic7_64bit.phpt --TEST-- Test vsprintf() 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 vsprintf(string $format , aaray $args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing vsprintf() : basic functionality - using unsigned format ***\n"; // Initialise all required variables $format = "format"; $format1 = "%u"; $format2 = "%u %u"; $format3 = "%u %u %u"; $arg1 = array(-1111); $arg2 = array(-1111,-1234567); $arg3 = array(-1111,-1234567,-2345432); var_dump( vsprintf($format1,$arg1) ); var_dump( vsprintf($format2,$arg2) ); var_dump( vsprintf($format3,$arg3) ); echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : basic functionality - using unsigned format *** string(20) "18446744073709550505" string(41) "18446744073709550505 18446744073708317049" string(62) "18446744073709550505 18446744073708317049 18446744073707206184" Done --UEXPECTF-- *** Testing vsprintf() : basic functionality - using unsigned format *** unicode(20) "18446744073709550505" unicode(41) "18446744073709550505 18446744073708317049" unicode(62) "18446744073709550505 18446744073708317049 18446744073707206184" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation11_64bit.phpt --TEST-- Test vsprintf() function : usage variations - octal formats with octal values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different octal formats and octal values are passed to * the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : octal formats with octal values ***\n"; // defining array of octal formats $formats = array( "%o", "%+o %-o %O", "%lo %Lo, %4o %-4o", "%10.4o %-10.4o %04o %04.4o", "%'#2o %'2o %'$2o %'_2o", "%o %o %o %o", "%% %%o %10 o%", '%3$o %4$o %1$o %2$o' ); // Arrays of octal values for the format defined in $format. // Each sub array contains octal values which correspond to each format string in $format $args_array = array( array(00), array(-01, 01, +022), array(-020000000000, 020000000000, 017777777777, -017777777777), array(0123456, 012345678, -01234567, 01234567), array(0111, 02222, -0333333, -044444444), array(0x123b, 0xfAb, 0123, 01293), array(01234, 05678, -01234, 02345), array(03, 04, 01, 02) ); // looping to test vsprintf() with different octal formats from the above $formats array // and with octal values from the above $args_array array $counter = 1; foreach($formats as $format) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($format, $args_array[$counter-1]) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : octal formats with octal values *** -- Iteration 1 -- string(1) "0" -- Iteration 2 -- string(25) "1777777777777777777777 1 " -- Iteration 3 -- string(60) "1777777777760000000000 o, 17777777777 1777777777760000000001" -- Iteration 4 -- string(49) " 1777777777777776543211 0000" -- Iteration 5 -- string(54) "111 2222 1777777777777777444445 1777777777777733333334" -- Iteration 6 -- string(17) "11073 7653 123 12" -- Iteration 7 -- string(6) "% %o o" -- Iteration 8 -- string(7) "1 2 3 4" Done --UEXPECTF-- *** Testing vsprintf() : octal formats with octal values *** -- Iteration 1 -- unicode(1) "0" -- Iteration 2 -- unicode(25) "1777777777777777777777 1 " -- Iteration 3 -- unicode(60) "1777777777760000000000 o, 17777777777 1777777777760000000001" -- Iteration 4 -- unicode(49) " 1777777777777776543211 0000" -- Iteration 5 -- unicode(54) "111 2222 1777777777777777444445 1777777777777733333334" -- Iteration 6 -- unicode(17) "11073 7653 123 12" -- Iteration 7 -- unicode(6) "% %o o" -- Iteration 8 -- unicode(7) "1 2 3 4" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation12_64bit.phpt --TEST-- Test vsprintf() function : usage variations - octal formats with non-octal values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different octal formats and non-octal values are passed to * the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : octal formats and non-octal values ***\n"; // defining array of octal formats $formats = '%o %+o %-o %lo %Lo %4o %-4o %10.4o %-10.4o %.4o %\'#2o %\'2o %\'$2o %\'_2o %3$o %4$o %1$o %2$o'; // Arrays of non octal values for the format defined in $format. // Each sub array contains non octal values which correspond to each format in $format $args_array = array( // array of float values array(2.2, .2, 10.2, 123456.234, 123456.234, -1234.6789, +1234.6789, 2e10, +2e12, 22e+12, 12345.780, 12.000000011111, -12.00000111111, -123456.234, 3.33, +4.44, 1.11,-2.22 ), // array of int values array(2, -2, +2, 123456, 123456234, -12346789, +12346789, 123200, +20000, 22212, 12345780, 1211111, -12111111, -12345634, 3, +4, 1,-2 ), // array of strings array(" ", ' ', 'hello', '123hello', "123hello", '-123hello', '+123hello', "\12345678hello", "-\12345678hello", 'h123456ello', "1234hello", "hello\0world", "NULL", "true", "3", "4", '1', '2'), // different arrays array( array(0), array(1, 2), array(-1, -1), array("123"), array('123'), array('-123'), array("-123"), array(true), array(false), array(FALSE), array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"), array("3"), array("4"), array("1"), array("2") ), // array of boolean data array( true, TRUE, false, TRUE, 0, FALSE, 1, true, false, TRUE, 0, 1, 1, 0, 1, TRUE, 0, FALSE), ); // looping to test vsprintf() with different octal formats from the above $format array // and with non-octal values from the above $args_array array $counter = 1; foreach($args_array as $args) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($formats, $args) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : octal formats and non-octal values *** -- Iteration 1 -- string(149) "2 0 12 361100 o 1777777777777777775456 2322 30071 14 1777777777777777777764 1777777777777777416700 12 361100 2 0" -- Iteration 2 -- string(201) "2 1777777777777777777776 2 361100 o 1777777777777720715133 57062645 57060664 4475347 1777777777777721631371 1777777777777720717336 2 361100 2 1777777777777777777776" -- Iteration 3 -- string(99) "0 0 0 173 o 1777777777777777777605 173 2322 0 $0 _0 0 173 0 0" -- Iteration 4 -- string(75) "1 1 1 1 o 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 5 -- string(75) "1 1 0 1 o 0 1 #0 1 $1 _0 0 1 1 1" Done --UEXPECTF-- *** Testing vsprintf() : octal formats and non-octal values *** -- Iteration 1 -- unicode(149) "2 0 12 361100 o 1777777777777777775456 2322 30071 14 1777777777777777777764 1777777777777777416700 12 361100 2 0" -- Iteration 2 -- unicode(201) "2 1777777777777777777776 2 361100 o 1777777777777720715133 57062645 57060664 4475347 1777777777777721631371 1777777777777720717336 2 361100 2 1777777777777777777776" -- Iteration 3 -- unicode(99) "0 0 0 173 o 1777777777777777777605 173 2322 0 $0 _0 0 173 0 0" -- Iteration 4 -- unicode(75) "1 1 1 1 o 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 5 -- unicode(75) "1 1 0 1 o 0 1 #0 1 $1 _0 0 1 1 1" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation13_64bit.phpt --TEST-- Test vsprintf() function : usage variations - hexa formats with hexa values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different hexa formats and hexa values are passed to * the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : hexa formats with hexa values ***\n"; // defining array of different hexa formats $formats = array( "%x", "%+x %-x %X", "%lx %Lx, %4x %-4x", "%10.4x %-10.4x %04x %04.4x", "%'#2x %'2x %'$2x %'_2x", "%x %x %x %x", "% %%x x%", '%3$x %4$x %1$x %2$x' ); // Arrays of hexa values for the format defined in $format. // Each sub array contains hexa values which correspond to each format string in $format $args_array = array( array(0x0), array(-0x1, 0x1, +0x22), array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000), array(123456, 12345678, -1234567, 1234567), array(1, 0x2222, 0333333, -0x44444444), array(0x123b, 0xfAb, "0xaxz", 01293), array(0x1234, 0x34, 0x2ff), array(0x3, 0x4, 0x1, 0x2) ); // looping to test vsprintf() with different char octal from the above $format array // and with octal values from the above $args_array array $counter = 1; foreach($formats as $format) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($format, $args_array[$counter-1]) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : hexa formats with hexa values *** -- Iteration 1 -- string(1) "0" -- Iteration 2 -- string(21) "ffffffffffffffff 1 22" -- Iteration 3 -- string(36) "7fffffff x, 7000000 ffffffff80000000" -- Iteration 4 -- string(43) " ffffffffffed2979 0000" -- Iteration 5 -- string(30) "#1 2222 1b6db ffffffffbbbbbbbc" -- Iteration 6 -- string(12) "123b fab 0 a" -- Iteration 7 -- string(5) "%34 x" -- Iteration 8 -- string(7) "1 2 3 4" Done --UEXPECTF-- *** Testing vsprintf() : hexa formats with hexa values *** -- Iteration 1 -- unicode(1) "0" -- Iteration 2 -- unicode(21) "ffffffffffffffff 1 22" -- Iteration 3 -- unicode(36) "7fffffff x, 7000000 ffffffff80000000" -- Iteration 4 -- unicode(43) " ffffffffffed2979 0000" -- Iteration 5 -- unicode(30) "#1 2222 1b6db ffffffffbbbbbbbc" -- Iteration 6 -- unicode(12) "123b fab 0 a" -- Iteration 7 -- unicode(5) "%34 x" -- Iteration 8 -- unicode(7) "1 2 3 4" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation14_64bit.phpt --TEST-- Test vsprintf() function : usage variations - hexa formats with non-hexa values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different hexa formats and non-hexa values are passed to * the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n"; // defining array of different hexa formats $formats = '%x %+x %-x %lx %Lx %4x %-4x %10.4x %-10.4x %.4x %\'#2x %\'2x %\'$2x %\'_2x %3$x %4$x %1$x %2$x'; // Arrays of non hexa values for the format defined in $format. // Each sub array contains non hexa values which correspond to each format in $format $args_array = array( // array of float values array(2.2, .2, 10.2, 123456.234, 123456.234, -1234.6789, +1234.6789, 2e10, +2e12, 22e+12, 12345.780, 12.000000011111, -12.00000111111, -123456.234, 3.33, +4.44, 1.11,-2.22 ), // array of int values array(2, -2, +2, 123456, 123456234, -12346789, +12346789, 123200, +20000, 22212, 12345780, 1211111, -12111111, -12345634, 3, +4, 1,-2 ), // array of strings array(" ", ' ', 'hello', '123hello', "123hello", '-123hello', '+123hello', "\12345678hello", "-\12345678hello", 'h123456ello', "1234hello", "hello\0world", "NULL", "true", "3", "4", '1', '2'), // different arrays array( array(0), array(1, 2), array(-1, -1), array("123"), array('123'), array('-123'), array("-123"), array(true), array(TRUE), array(FALSE), array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"), array("3"), array("4"), array("1"), array("2") ), // array of boolean data array( true, TRUE, false, TRUE, 0, FALSE, 1, true, TRUE, FALSE, 0, 1, 1, 0, 1, TRUE, 0, FALSE), ); // looping to test vsprintf() with different hexa formats from the above $format array // and with non-hexa values from the above $args_array array $counter = 1; foreach($args_array as $args) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($formats, $args) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : hexa formats and non-hexa values *** -- Iteration 1 -- string(125) "2 0 a 1e240 x fffffffffffffb2e 4d2 3039 c fffffffffffffff4 fffffffffffe1dc0 a 1e240 2 0" -- Iteration 2 -- string(164) "2 fffffffffffffffe 2 1e240 x ffffffffff439a5b bc65a5 bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede 2 1e240 2 fffffffffffffffe" -- Iteration 3 -- string(90) "0 0 0 7b x ffffffffffffff85 7b 4d2 0 $0 _0 0 7b 0 0" -- Iteration 4 -- string(75) "1 1 1 1 x 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 5 -- string(75) "1 1 0 1 x 0 1 #0 1 $1 _0 0 1 1 1" Done --UEXPECTF-- *** Testing vsprintf() : hexa formats and non-hexa values *** -- Iteration 1 -- unicode(125) "2 0 a 1e240 x fffffffffffffb2e 4d2 3039 c fffffffffffffff4 fffffffffffe1dc0 a 1e240 2 0" -- Iteration 2 -- unicode(164) "2 fffffffffffffffe 2 1e240 x ffffffffff439a5b bc65a5 bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede 2 1e240 2 fffffffffffffffe" -- Iteration 3 -- unicode(90) "0 0 0 7b x ffffffffffffff85 7b 4d2 0 $0 _0 0 7b 0 0" -- Iteration 4 -- unicode(75) "1 1 1 1 x 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 5 -- unicode(75) "1 1 0 1 x 0 1 #0 1 $1 _0 0 1 1 1" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation15_64bit.phpt --TEST-- Test vsprintf() function : usage variations - unsigned formats with unsigned values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different unsigned formats and unsigned values * are passed to the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n"; // defining array of unsigned formats $formats = array( '%u %+u %-u', '%lu %Lu %4u %-4u', '%10.4u %-10.4u %.4u', '%\'#2u %\'2u %\'$2u %\'_2u', '%3$u %4$u %1$u %2$u' ); // Arrays of unsigned values for the format defined in $format. // Each sub array contains unsigned values which correspond to each format string in $format $args_array = array( array(1234567, 01234567, 0 ), array(12345678900, 12345678900, 1234, 12345), array("1234000", 10e20, 1.2e2), array(1, 0, 00, "10_"), array(3, 4, 1, 2) ); // looping to test vsprintf() with different unsigned formats from the above $format array // and with signed and other types of values from the above $args_array array $counter = 1; foreach($formats as $format) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($format, $args_array[$counter-1]) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : unsigned formats and unsigned values *** -- Iteration 1 -- string(16) "1234567 342391 0" -- Iteration 2 -- string(24) "12345678900 u 1234 12345" -- Iteration 3 -- string(25) " 1234000 0 120" -- Iteration 4 -- string(10) "#1 0 $0 10" -- Iteration 5 -- string(7) "1 2 3 4" Done --UEXPECTF-- *** Testing vsprintf() : unsigned formats and unsigned values *** -- Iteration 1 -- unicode(16) "1234567 342391 0" -- Iteration 2 -- unicode(24) "12345678900 u 1234 12345" -- Iteration 3 -- unicode(25) " 1234000 0 120" -- Iteration 4 -- unicode(10) "#1 0 $0 10" -- Iteration 5 -- unicode(7) "1 2 3 4" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation16_64bit.phpt --TEST-- Test vsprintf() function : usage variations - unsigned formats with signed and other types of values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different unsigned formats and signed values and other types of values * are passed to the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n"; // defining array of unsigned formats $formats = '%u %+u %-u %lu %Lu %4u %-4u %10.4u %-10.4u %.4u %\'#2u %\'2u %\'$2u %\'_2u %3$u %4$u %1$u %2$u'; // Arrays of signed and other type of values for the format defined in $format. // Each sub array contains signed values which correspond to each format in $format $args_array = array( // array of float values array(+2.2, +.2, +10.2, +123456.234, +123456.234, +1234.6789, +2e10, +2e12, +22e+12, +12345.780, +12.000000011111, -12.00000111111, -123456.234, +3.33, +4.44, +1.11,-2.22 ), // array of strings array(" ", ' ', 'hello', '123hello', "123hello", '-123hello', '+123hello', "\12345678hello", "-\12345678hello", 'h123456ello', "1234hello", "hello\0world", "NULL", "true", "3", "4", '1', '2'), // different arrays array( array(0), array(1, 2), array(-1, -1), array("123"), array('123'), array('-123'), array("-123"), array(true), array(TRUE), array(FALSE), array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"), array("3"), array("4"), array("1"), array("2") ), // array of boolean data array( true, TRUE, false, TRUE, 0, FALSE, 1, true, TRUE, FALSE, 0, 1, 1, 0, 1, TRUE, 0, FALSE), ); // looping to test vsprintf() with different unsigned formats from the above $format array // and with signed and other types of values from the above $args_array array $counter = 1; foreach($args_array as $args) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($formats, $args) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : unsigned formats and signed & other types of values *** -- Iteration 1 -- string(143) "2 0 10 123456 u 1234 20000000000 2000000000000 22000000000000 12345 12 18446744073709551604 18446744073709428160 _3 10 123456 2 0" -- Iteration 2 -- string(98) "0 0 0 123 u 18446744073709551493 123 0 0 0 1234 0 $0 _0 0 123 0 0" -- Iteration 3 -- string(76) "1 1 1 1 u 1 1 1 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 4 -- string(76) "1 1 0 1 u 0 1 1 1 0 #0 1 $1 _0 0 1 1 1" Done --UEXPECTF-- *** Testing vsprintf() : unsigned formats and signed & other types of values *** -- Iteration 1 -- unicode(143) "2 0 10 123456 u 1234 20000000000 2000000000000 22000000000000 12345 12 18446744073709551604 18446744073709428160 _3 10 123456 2 0" -- Iteration 2 -- unicode(98) "0 0 0 123 u 18446744073709551493 123 0 0 0 1234 0 $0 _0 0 123 0 0" -- Iteration 3 -- unicode(76) "1 1 1 1 u 1 1 1 1 1 #1 1 $1 _1 1 1 1 1" -- Iteration 4 -- unicode(76) "1 1 0 1 u 0 1 1 1 0 #0 1 $1 _0 0 1 1 1" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation19_64bit.phpt --TEST-- Test vsprintf() function : usage variations - with whitespaces in format strings --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string $format , array $args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ echo "*** Testing vsprintf() : with white spaces in format strings ***\n"; // initializing the format array $formats = array( "% d % d % d", "% f % f % f", "% F % F % F", "% b % b % b", "% c % c % c", "% e % e % e", "% u % u % u", "% o % o % o", "% x % x % x", "% X % X % X", "% E % E % E" ); // initializing the args array $args_array = array( array(111, 222, 333), array(1.1, .2, -0.6), array(1.12, -1.13, +0.23), array(1, 2, 3), array(65, 66, 67), array(2e1, 2e-1, -2e1), array(-11, +22, 33), array(012, -02394, +02389), array(0x11, -0x22, +0x33), array(0x11, -0x22, +0x33), array(2e1, 2e-1, -2e1) ); $counter = 1; foreach($formats as $format) { echo"\n-- Iteration $counter --\n"; var_dump( vsprintf($format, $args_array[$counter-1]) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : with white spaces in format strings *** -- Iteration 1 -- string(13) "111 222 333" -- Iteration 2 -- string(29) "1.100000 0.200000 -0.600000" -- Iteration 3 -- string(29) "1.120000 -1.130000 0.230000" -- Iteration 4 -- string(9) "1 10 11" -- Iteration 5 -- string(7) "A B C" -- Iteration 6 -- string(38) "2.000000e+1 2.000000e-1 -2.000000e+1" -- Iteration 7 -- string(28) "18446744073709551605 22 33" -- Iteration 8 -- string(30) "12 1777777777777777777755 23" -- Iteration 9 -- string(24) "11 ffffffffffffffde 33" -- Iteration 10 -- string(24) "11 FFFFFFFFFFFFFFDE 33" -- Iteration 11 -- string(38) "2.000000E+1 2.000000E-1 -2.000000E+1" Done --UEXPECTF-- *** Testing vsprintf() : with white spaces in format strings *** -- Iteration 1 -- unicode(13) "111 222 333" -- Iteration 2 -- unicode(29) "1.100000 0.200000 -0.600000" -- Iteration 3 -- unicode(29) "1.120000 -1.130000 0.230000" -- Iteration 4 -- unicode(9) "1 10 11" -- Iteration 5 -- unicode(7) "A B C" -- Iteration 6 -- unicode(38) "2.000000e+1 2.000000e-1 -2.000000e+1" -- Iteration 7 -- unicode(28) "18446744073709551605 22 33" -- Iteration 8 -- unicode(30) "12 1777777777777777777755 23" -- Iteration 9 -- unicode(24) "11 ffffffffffffffde 33" -- Iteration 10 -- unicode(24) "11 FFFFFFFFFFFFFFDE 33" -- Iteration 11 -- unicode(38) "2.000000E+1 2.000000E-1 -2.000000E+1" Done http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt?view=markup&rev=1.1 Index: php-src/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt +++ php-src/ext/standard/tests/strings/vsprintf_variation4_64bit.phpt --TEST-- Test vsprintf() function : usage variations - int formats with non-integer values --SKIPIF-- <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only"); ?> --FILE-- <?php /* Prototype : string vsprintf(string format, array args) * Description: Return a formatted string * Source code: ext/standard/formatted_print.c */ /* * Test vsprintf() when different int formats and non-int values are passed to * the '$format' and '$args' arguments of the function */ echo "*** Testing vsprintf() : int formats and non-integer values ***\n"; // defining array of int formats $formats = '%d %+d %-d %ld %Ld %4d %-4d %10.4d %-10.4d %.4d %04.4d %\'#2d %\'2d %\'$2d %\'_2d %3$d %4$d %1$d %2$d'; // Arrays of non int values for the format defined in $format. // Each sub array contains non int values which correspond to each format in $format $args_array = array( // array of float values array(2.2, .2, 10.2, 123456.234, 123456.234, -1234.6789, +1234.6789, 2e10, +2e5, 4e3, 22e+6, 12345.780, 12.000000011111, -12.00000111111, -123456.234, 3.33, +4.44, 1.11,-2.22 ), // array of strings array(" ", ' ', 'hello', '123hello', "123hello", '-123hello', '+123hello', "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello', "1234hello", "hello\0world", "NULL", "true", "3", "4", '1', '2'), // different arrays array( array(0), array(1, 2), array(-1, -1), array("123"), array('123'), array('-123'), array("-123"), array(true), array(false), array(TRUE), array(FALSE), array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"), array("3"), array("4"), array("1"), array("2") ), // array of boolean data array( true, TRUE, false, TRUE, 0, FALSE, 1, true, false, TRUE, FALSE, 0, 1, 1, 0, 1, TRUE, 0, FALSE), ); // looping to test vsprintf() with different int formats from the above $format array // and with non-int values from the above $args_array array $counter = 1; foreach($args_array as $args) { echo "\n-- Iteration $counter --\n"; var_dump( vsprintf($formats, $args) ); $counter++; } echo "Done"; ?> --EXPECTF-- *** Testing vsprintf() : int formats and non-integer values *** -- Iteration 1 -- string(112) "2 +0 10 123456 d -1234 1234 20000000000 200000 4000 22000000 12345 12 -12 -123456 10 123456 2 0" -- Iteration 2 -- string(92) "0 +0 0 123 d -123 123 0 0 123456 0000 1234 0 $0 _0 0 123 0 0" -- Iteration 3 -- string(81) "1 +1 1 1 d 1 1 1 1 1 0001 #1 1 $1 _1 1 1 1 1" -- Iteration 4 -- string(81) "1 +1 0 1 d 0 1 1 0 1 0000 #0 1 $1 _0 0 1 1 1" Done --UEXPECTF-- *** Testing vsprintf() : int formats and non-integer values *** -- Iteration 1 -- unicode(112) "2 +0 10 123456 d -1234 1234 20000000000 200000 4000 22000000 12345 12 -12 -123456 10 123456 2 0" -- Iteration 2 -- unicode(92) "0 +0 0 123 d -123 123 0 0 123456 0000 1234 0 $0 _0 0 123 0 0" -- Iteration 3 -- unicode(81) "1 +1 1 1 d 1 1 1 1 1 0001 #1 1 $1 _1 1 1 1 1" -- Iteration 4 -- unicode(81) "1 +1 0 1 d 0 1 1 0 1 0000 #0 1 $1 _0 0 1 1 1" Done
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php