From: andy wharmby Date: Tue, 20 Jan 2009 14:19:40 +0000 (+0000) Subject: New vfprintf() tests. Tested on Window, Linux and Linux 64 bit X-Git-Tag: php-5.4.0alpha1~191^2~4450 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9c2283fe02a45ceba041e3de0ee17914d4049a12;p=php New vfprintf() tests. Tested on Window, Linux and Linux 64 bit --- diff --git a/ext/standard/tests/strings/sprintf_variation23.phpt b/ext/standard/tests/strings/sprintf_variation23.phpt index f502e589dd..69ebc01290 100644 --- a/ext/standard/tests/strings/sprintf_variation23.phpt +++ b/ext/standard/tests/strings/sprintf_variation23.phpt @@ -39,42 +39,40 @@ foreach($resource_values as $resource_value) { // closing the resources fclose($fp); -fclose($dfp); +closedir($dfp); -echo "Done"; ?> +===DONE=== --EXPECTF-- *** Testing sprintf() : char formats with resource values *** -- Iteration 1 -- -unicode(1) "" +unicode(1) "%a" unicode(1) "c" -unicode(1) "" +unicode(1) "%a" unicode(1) "c" -unicode(2) " " -unicode(2) " " -unicode(2) " " +unicode(2) " %a" +unicode(2) "%a " +unicode(2) " %a" unicode(2) " -" -unicode(1) "" -unicode(1) "" +%a" +unicode(1) "%a" +unicode(1) "%a" unicode(11) "a-bA-B@#$&]" unicode(1) "c" -- Iteration 2 -- -unicode(1) "" +unicode(1) "%a" +unicode(1) "%a" +unicode(1) "%a" unicode(1) "c" -unicode(1) "" -unicode(1) "c" -unicode(2) " " -unicode(2) " " -unicode(2) " " +unicode(2) " %a" +unicode(2) "%a " +unicode(2) " %a" unicode(2) " -" -unicode(1) "" -unicode(1) "" +%a" +unicode(1) "%a" +unicode(1) "%a" unicode(11) "a-bA-B@#$&]" unicode(1) "c" - -Warning: fclose(): %d is not a valid stream resource in %s on line %d -Done +===DONE=== diff --git a/ext/standard/tests/strings/sprintf_variation36.phpt b/ext/standard/tests/strings/sprintf_variation36.phpt index e3947dc556..792c242496 100644 --- a/ext/standard/tests/strings/sprintf_variation36.phpt +++ b/ext/standard/tests/strings/sprintf_variation36.phpt @@ -37,38 +37,42 @@ foreach($resource_values as $resource_value) { $count++; }; -echo "Done"; +// closing the resources +fclose($fp); +closedir($dfp); + ?> +===DONE=== --EXPECTF-- *** Testing sprintf() : hexa formats with resource values *** -- Iteration 1 -- -unicode(%d) "%d" -unicode(%d) "%dx" -unicode(%d) "%d" +unicode(%d) "%a" +unicode(%d) "%ax" +unicode(%d) "%a" unicode(1) "x" -unicode(%d) " %d" -unicode(%d) "%d " -unicode(%d) " %d" +unicode(%d) " %a" +unicode(%d) "%a " +unicode(%d) " %a" unicode(%d) " -%d" -unicode(%d) " %d" -unicode(%d) " %d" +%a" +unicode(4) "%a" +unicode(30) "%a" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -- Iteration 2 -- -unicode(%d) "%d" -unicode(%d) "%dx" -unicode(%d) "%d" +unicode(%d) "%a" +unicode(%d) "%ax" +unicode(%d) "%a" unicode(1) "x" -unicode(%d) " %d" -unicode(%d) "%d " -unicode(%d) " %d" +unicode(%d) " %a" +unicode(%d) "%a " +unicode(%d) " %a" unicode(%d) " -%d" -unicode(%d) " %d" -unicode(%d) " %d" +%a" +unicode(4) "%a" +unicode(30) "%a" unicode(10) "0-9A-Fa-f]" unicode(1) "x" -Done +===DONE=== diff --git a/ext/standard/tests/strings/sprintf_variation48.phpt b/ext/standard/tests/strings/sprintf_variation48.phpt index 949f448fa2..3317ae41ab 100644 --- a/ext/standard/tests/strings/sprintf_variation48.phpt +++ b/ext/standard/tests/strings/sprintf_variation48.phpt @@ -41,9 +41,8 @@ foreach($resource_values as $resource_value) { fclose($fp); closedir($dfp); - -echo "Done"; ?> +===DONE=== --EXPECTF-- *** Testing sprintf() : scientific formats with resource values *** @@ -58,7 +57,7 @@ unicode(%d) " %f" unicode(%d) " %f" unicode(%d) "%f" -unicode(%d) "%s%f" +unicode(30) "%s%f" unicode(%d) "0-1]" unicode(1) "e" @@ -73,7 +72,7 @@ unicode(%d) " %f" unicode(%d) " %f" unicode(%d) "%f" -unicode(%d) "%s%f" +unicode(30) "%s%f" unicode(%d) "0-1]" unicode(1) "e" -Done +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic1.phpt b/ext/standard/tests/strings/vfprintf_basic1.phpt new file mode 100644 index 0000000000..3129d4fcca --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic1.phpt @@ -0,0 +1,49 @@ +--TEST-- +Test vfprintf() function : basic functionality - string format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using string format *** +int(4) +int(8) +int(14) +one +one two +one two three +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic2.phpt b/ext/standard/tests/strings/vfprintf_basic2.phpt new file mode 100644 index 0000000000..a7e0dbc63b --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic2.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test vfprintf() function : basic functionality - integer format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using integer format *** +111 +111 222 +111 222 333 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic3.phpt b/ext/standard/tests/strings/vfprintf_basic3.phpt new file mode 100644 index 0000000000..8c52e57f95 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic3.phpt @@ -0,0 +1,63 @@ +--TEST-- +Test vfprintf() function : basic functionality - float format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using float format *** +11.110000 +11.110000 +11.110000 22.220000 +11.110000 22.220000 +11.110000 22.220000 33.330000 +11.110000 22.220000 33.330000 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic4.phpt b/ext/standard/tests/strings/vfprintf_basic4.phpt new file mode 100644 index 0000000000..76b3a04217 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic4.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : basic functionality - bool format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using bool format *** +1 +1 0 +1 0 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic5.phpt b/ext/standard/tests/strings/vfprintf_basic5.phpt new file mode 100644 index 0000000000..1acb7ebc74 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic5.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : basic functionality - char format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using char format *** +A +A B +A B C +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic6.phpt b/ext/standard/tests/strings/vfprintf_basic6.phpt new file mode 100644 index 0000000000..be28226123 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic6.phpt @@ -0,0 +1,48 @@ +--TEST-- +Test vfprintf() function : basic functionality - exponential format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using exponential format *** +1.000000e+3 +1.000000e+3 2.000000e+3 +1.000000e+3 2.000000e+3 3.000000e+3 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic7.phpt b/ext/standard/tests/strings/vfprintf_basic7.phpt new file mode 100644 index 0000000000..740fc17a99 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic7.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +4294966185 +4294966185 4293732729 +4294966185 4293732729 4292621864 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt new file mode 100644 index 0000000000..77fae2c09b --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic7_64bit.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test vfprintf() function : basic functionality - unsigned format +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using unsigned format *** +18446744073709550505 +18446744073709550505 18446744073708317049 +18446744073709550505 18446744073708317049 18446744073707206184 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic8.phpt b/ext/standard/tests/strings/vfprintf_basic8.phpt new file mode 100644 index 0000000000..6fe2151542 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic8.phpt @@ -0,0 +1,46 @@ +--TEST-- +Test vfprintf() function : basic functionality - octal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : basic functionality - using octal format *** +21 +21 347 +21 347 567 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_basic9.phpt b/ext/standard/tests/strings/vfprintf_basic9.phpt new file mode 100644 index 0000000000..8294c8482f --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_basic9.phpt @@ -0,0 +1,60 @@ +--TEST-- +Test vfprintf) function : basic functionality - hexadecimal format +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf) : basic functionality - using hexadecimal format *** +b +B +b 84 +B 84 +b 84 b1 +B 84 B1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation10.phpt b/ext/standard/tests/strings/vfprintf_variation10.phpt new file mode 100644 index 0000000000..84d739d292 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation10.phpt @@ -0,0 +1,121 @@ +--TEST-- +Test vfprintf() function : usage variations - char formats with non-char values +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different char formats from the above $format array +// and with non-char values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : char formats and non-char values *** + +-- Iteration 1 -- +A %s B + ] c %s %s + # %s %s + %s = 2 %s + B ] A %s +-- Iteration 2 -- +A %s B + %s c %s %s + # %s %s + %s = 2 %s + B %s A %s +-- Iteration 3 -- +%c %c %c + { c %s { + %c %c @ %c + %s %c %c %c + %c { %c %c +-- Iteration 4 -- +%c %c %c + %c c %c %c + %c %c %c %c + %c %c %c %c + %c %c %c %c +-- Iteration 5 -- +%c %c %c + %c c %c %c + %c %c %c %c + %c %c %c %c + %c %c %c %c +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation11.phpt b/ext/standard/tests/strings/vfprintf_variation11.phpt new file mode 100644 index 0000000000..45f1f61fa6 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation11.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +37777777777 1 +-- Iteration 3 -- +20000000000 o, 17777777777 20000000001 +-- Iteration 4 -- + 37776543211 0000 +-- Iteration 5 -- +111 2222 37777444445 37733333334 +-- Iteration 6 -- +11073 7653 123 12 +-- Iteration 7 -- +% %o o +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt new file mode 100644 index 0000000000..d6549846b5 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation11_64bit.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with octal values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats with octal values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1777777777777777777777 1 +-- Iteration 3 -- +1777777777760000000000 o, 17777777777 1777777777760000000001 +-- Iteration 4 -- + 1777777777777776543211 0000 +-- Iteration 5 -- +111 2222 1777777777777777444445 1777777777777733333334 +-- Iteration 6 -- +11073 7653 123 12 +-- Iteration 7 -- +% %o o +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation12.phpt b/ext/standard/tests/strings/vfprintf_variation12.phpt new file mode 100644 index 0000000000..e95fd5bb7f --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation12.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 37777775456 2322 + + 30071 14 37777777764 37777416700 + 12 361100 2 0 +-- Iteration 2 -- +2 37777777776 2 + 361100 o 37720715133 57062645 + + 57060664 4475347 37721631371 37720717336 + 2 361100 2 37777777776 +-- Iteration 3 -- +0 0 0 + 173 o 37777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt new file mode 100644 index 0000000000..a1e57bc42c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation12_64bit.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - octal formats with non-octal values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : octal formats and non-octal values *** + +-- Iteration 1 -- +2 0 12 + 361100 o 1777777777777777775456 2322 + + 30071 14 1777777777777777777764 1777777777777777416700 + 12 361100 2 0 +-- Iteration 2 -- +2 1777777777777777777776 2 + 361100 o 1777777777777720715133 57062645 + + 57060664 4475347 1777777777777721631371 1777777777777720717336 + 2 361100 2 1777777777777777777776 +-- Iteration 3 -- +0 0 0 + 173 o 1777777777777777777605 173 + + 2322 0 $0 _0 + 0 173 0 0 +-- Iteration 4 -- +1 1 1 + 1 o 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 o 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation13.phpt b/ext/standard/tests/strings/vfprintf_variation13.phpt new file mode 100644 index 0000000000..245feb5a23 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation13.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +ffffffff 1 22 +-- Iteration 3 -- +7fffffff x, 7000000 80000000 +-- Iteration 4 -- + ffed2979 0000 +-- Iteration 5 -- +#1 2222 1b6db bbbbbbbc +-- Iteration 6 -- +123b fab 0 a +-- Iteration 7 -- +%34 x +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt new file mode 100644 index 0000000000..bf6fcb5ec0 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation13_64bit.phpt @@ -0,0 +1,88 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with hexa values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats with hexa values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +ffffffffffffffff 1 22 +-- Iteration 3 -- +7fffffff x, 7000000 ffffffff80000000 +-- Iteration 4 -- + ffffffffffed2979 0000 +-- Iteration 5 -- +#1 2222 1b6db ffffffffbbbbbbbc +-- Iteration 6 -- +123b fab 0 a +-- Iteration 7 -- +%34 x +-- Iteration 8 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation14.phpt b/ext/standard/tests/strings/vfprintf_variation14.phpt new file mode 100644 index 0000000000..c714d89758 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation14.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffb2e 4d2 + + 3039 c fffffff4 fffe1dc0 + a 1e240 2 0 +-- Iteration 2 -- +2 fffffffe 2 + 1e240 x ff439a5b bc65a5 + + bc61b4 127ae7 ff4732f9 ff439ede + 2 1e240 2 fffffffe +-- Iteration 3 -- +0 0 0 + 7b x ffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt new file mode 100644 index 0000000000..930ee3d03d --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation14_64bit.phpt @@ -0,0 +1,125 @@ +--TEST-- +Test vfprintf() function : usage variations - hexa formats with non-hexa values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : hexa formats and non-hexa values *** + +-- Iteration 1 -- +2 0 a + 1e240 x fffffffffffffb2e 4d2 + + 3039 c fffffffffffffff4 fffffffffffe1dc0 + a 1e240 2 0 +-- Iteration 2 -- +2 fffffffffffffffe 2 + 1e240 x ffffffffff439a5b bc65a5 + + bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede + 2 1e240 2 fffffffffffffffe +-- Iteration 3 -- +0 0 0 + 7b x ffffffffffffff85 7b + + 4d2 0 $0 _0 + 0 7b 0 0 +-- Iteration 4 -- +1 1 1 + 1 x 1 1 + + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 5 -- +1 1 0 + 1 x 0 1 + + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation15.phpt b/ext/standard/tests/strings/vfprintf_variation15.phpt new file mode 100644 index 0000000000..a4046951dd --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation15.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +-- Iteration 2 -- +2147483647 u 1234 12345 +-- Iteration 3 -- + 1234000 2147483647 120 +-- Iteration 4 -- +#1 0 $0 10 +-- Iteration 5 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt new file mode 100644 index 0000000000..d2e331c2d3 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation15_64bit.phpt @@ -0,0 +1,75 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with unsigned values +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and unsigned values *** + +-- Iteration 1 -- +1234567 342391 0 +-- Iteration 2 -- +12345678900 u 1234 12345 +-- Iteration 3 -- + 1234000 101234567000 120 +-- Iteration 4 -- +#1 0 $0 10 +-- Iteration 5 -- +1 2 3 4 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation16.phpt b/ext/standard/tests/strings/vfprintf_variation16.phpt new file mode 100644 index 0000000000..8be18ce5a9 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation16.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 2147483647 + 2147483647 2147483647 12345 + 12 4294967284 4294843840 _3 + 10 123456 2 0 +-- Iteration 2 -- +0 0 0 + 123 u 4294967173 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt new file mode 100644 index 0000000000..381e67c339 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation16_64bit.phpt @@ -0,0 +1,112 @@ +--TEST-- +Test vfprintf() function : usage variations - unsigned formats with signed and other types of values +--SKIPIF-- + +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : unsigned formats and signed & other types of values *** + +-- Iteration 1 -- +2 0 10 + 123456 u 1234 20000000000 + 2000000000000 22000000000000 12345 + 12 18446744073709551604 18446744073709428160 _3 + 10 123456 2 0 +-- Iteration 2 -- +0 0 0 + 123 u 18446744073709551493 123 + 0 0 0 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 1 1 + 1 u 1 1 + 1 1 1 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 1 0 + 1 u 0 1 + 1 1 0 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation17.phpt b/ext/standard/tests/strings/vfprintf_variation17.phpt new file mode 100644 index 0000000000..871ae98d85 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation17.phpt @@ -0,0 +1,70 @@ +--TEST-- +Test vfprintf() function : usage variations - scientific formats with scientific values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : scientific formats and scientific values *** + +-- Iteration 1 -- +0.000000e+0 +1.000000e+0 1.000000e+3 +-- Iteration 2 -- +2.200000e+2 e 1.000000e+1 1.000000e+10 +-- Iteration 3 -- +-2.2000e+13 1.0000e+21 1.2000e+2 +-- Iteration 4 -- +#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2 +-- Iteration 5 -- +1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation18.phpt b/ext/standard/tests/strings/vfprintf_variation18.phpt new file mode 100644 index 0000000000..76168621c3 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation18.phpt @@ -0,0 +1,107 @@ +--TEST-- +Test vfprintf() function : usage variations - scientific formats with non-scientific values +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different scientific formats from the above $format array +// and with non-scientific values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : scientific formats and non-scientific values *** + +-- Iteration 1 -- +2.200000e+0 +2.000000e-1 1.020000e+1 + 1.234562e+5 e -1.234679e+3 1.234679e+3 + 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3 + 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5 + 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1 +-- Iteration 2 -- +0.000000e+0 +0.000000e+0 0.000000e+0 + 1.230000e+2 e -1.230000e+2 1.230000e+2 + 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0 + 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0 + 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0 +-- Iteration 3 -- +1.000000e+0 +1.000000e+0 1.000000e+0 + 1.000000e+0 e 1.000000e+0 1.000000e+0 + 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 + 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +-- Iteration 4 -- +1.000000e+0 +1.000000e+0 0.000000e+0 + 1.000000e+0 e 0.000000e+0 1.000000e+0 + 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0 + 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation19.phpt b/ext/standard/tests/strings/vfprintf_variation19.phpt new file mode 100644 index 0000000000..7ee01a97e1 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation19.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vfprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +-- Iteration 4 -- +1 10 11 +-- Iteration 5 -- +A B C +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +-- Iteration 7 -- +4294967285 22 33 +-- Iteration 8 -- +12 37777777755 23 +-- Iteration 9 -- +11 ffffffde 33 +-- Iteration 10 -- +11 FFFFFFDE 33 +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt new file mode 100644 index 0000000000..58810a811a --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation19_64bit.phpt @@ -0,0 +1,94 @@ +--TEST-- +Test vfprintf() function : usage variations - with whitespaces in format strings +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : with white spaces in format strings *** + +-- Iteration 1 -- +111 222 333 +-- Iteration 2 -- +1.100000 0.200000 -0.600000 +-- Iteration 3 -- +1.120000 -1.130000 0.230000 +-- Iteration 4 -- +1 10 11 +-- Iteration 5 -- +A B C +-- Iteration 6 -- +2.000000e+1 2.000000e-1 -2.000000e+1 +-- Iteration 7 -- +18446744073709551605 22 33 +-- Iteration 8 -- +12 1777777777777777777755 23 +-- Iteration 9 -- +11 ffffffffffffffde 33 +-- Iteration 10 -- +11 FFFFFFFFFFFFFFDE 33 +-- Iteration 11 -- +2.000000E+1 2.000000E-1 -2.000000E+1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation20.phpt b/ext/standard/tests/strings/vfprintf_variation20.phpt new file mode 100644 index 0000000000..cd348d8350 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation20.phpt @@ -0,0 +1,175 @@ +--TEST-- +Test vfprintf() function : usage variations - unexpected values for the format argument +--FILE-- + 'red', 'item' => 'pen'), + + // null data +/*15*/ NULL, + null, + + // boolean data +/*17*/ true, + false, + TRUE, + FALSE, + + // empty data +/*21*/ "", + '', + + // object data +/*23*/ new sample(), + + // undefined data +/*24*/ @$undefined_var, + + // unset data +/*25*/ @$unset_var, + + // resource data +/*26*/ $file_handle +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +fprintf($fp, "\n*** Testing vprintf() with with unexpected values for format argument ***\n"); + +$counter = 1; +foreach( $values as $value ) { + fprintf( $fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $value, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : with unexpected values for format argument *** + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +Notice: Array to string conversion in %s on line %d + +*** Testing vprintf() with with unexpected values for format argument *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1 +-- Iteration 3 -- +12345 +-- Iteration 4 -- +-2345 +-- Iteration 5 -- +10.5 +-- Iteration 6 -- +-10.5 +-- Iteration 7 -- +101234567000 +-- Iteration 8 -- +1.07654321E-9 +-- Iteration 9 -- +0.5 +-- Iteration 10 -- +Array +-- Iteration 11 -- +Array +-- Iteration 12 -- +Array +-- Iteration 13 -- +Array +-- Iteration 14 -- +Array +-- Iteration 15 -- + +-- Iteration 16 -- + +-- Iteration 17 -- +1 +-- Iteration 18 -- + +-- Iteration 19 -- +1 +-- Iteration 20 -- + +-- Iteration 21 -- + +-- Iteration 22 -- + +-- Iteration 23 -- +object +-- Iteration 24 -- + +-- Iteration 25 -- + +-- Iteration 26 -- +Resource id #%d +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation21.phpt b/ext/standard/tests/strings/vfprintf_variation21.phpt new file mode 100644 index 0000000000..4dc9ed5666 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation21.phpt @@ -0,0 +1,168 @@ +--TEST-- +Test vfprintf() function : usage variations - unexpected values for args argument +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : with unexpected values for args argument *** + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +Warning: vfprintf(): Too few arguments in %s on line %d + +*** Testing vprintf() with unexpected values for args argument *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +1 +-- Iteration 3 -- +12345 +-- Iteration 4 -- +-2345 +-- Iteration 5 -- +10.5 +-- Iteration 6 -- +-10.5 +-- Iteration 7 -- +101234567000 +-- Iteration 8 -- +1.07654321E-9 +-- Iteration 9 -- +0.5 +-- Iteration 10 -- + +-- Iteration 11 -- + +-- Iteration 12 -- +1 +-- Iteration 13 -- + +-- Iteration 14 -- +1 +-- Iteration 15 -- + +-- Iteration 16 -- + +-- Iteration 17 -- + +-- Iteration 18 -- +string +-- Iteration 19 -- +string +-- Iteration 20 -- + +-- Iteration 21 -- + +-- Iteration 22 -- + +-- Iteration 23 -- +Resource id #%d +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation3.phpt b/ext/standard/tests/strings/vfprintf_variation3.phpt new file mode 100644 index 0000000000..02535cefb6 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation3.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with int values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats with int values *** + +-- Iteration 1 -- +0 +-- Iteration 2 -- +-1 1 +-- Iteration 3 -- +2147483647 d, 2147483640 -2147483640 +-- Iteration 4 -- + 123456 12345678 -1234567 1234567 +-- Iteration 5 -- +111 2222 333333 44444444 +-- Iteration 6 -- +4667 4011 83 10 +-- Iteration 7 -- +%-5678 d +-- Iteration 8 -- +1 2 3 4 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation4.phpt b/ext/standard/tests/strings/vfprintf_variation4.phpt new file mode 100644 index 0000000000..bdef534639 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation4.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"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), + +); + + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + 2147483647 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt new file mode 100644 index 0000000000..f7038ff76c --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation4_64bit.phpt @@ -0,0 +1,113 @@ +--TEST-- +Test vfprintf() function : usage variations - int formats with non-integer values +--SKIPIF-- + +--FILE-- +"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), + +); + + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() 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) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats and non-integer values *** + +-- Iteration 1 -- +2 +0 10 + 123456 d -1234 1234 + 20000000000 200000 4000 22000000 + 12345 12 -12 -123456 + 10 123456 2 0 +-- Iteration 2 -- +0 +0 0 + 123 d -123 123 + 0 0 123456 0000 + 1234 0 $0 _0 + 0 123 0 0 +-- Iteration 3 -- +1 +1 1 + 1 d 1 1 + 1 1 1 0001 + #1 1 $1 _1 + 1 1 1 1 +-- Iteration 4 -- +1 +1 0 + 1 d 0 1 + 1 0 1 0000 + #0 1 $1 _0 + 0 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation5.phpt b/ext/standard/tests/strings/vfprintf_variation5.phpt new file mode 100644 index 0000000000..4bac1ebe57 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation5.phpt @@ -0,0 +1,86 @@ +--TEST-- +Test vfprintf() function : usage variations - float formats with float values +--FILE-- + +===DONE=== +--EXPECT-- +*** Testing vfprintf() : int formats with float values *** + +-- Iteration 1 -- +0.000000 +-- Iteration 2 -- +-0.100000 0.100000 10.000001 +-- Iteration 3 -- +2147483649.000000 f, 2147483640.000000 -2147483640.000000 +-- Iteration 4 -- +200000.0000 0.0000 -200000.000000 -0.0000 +-- Iteration 5 -- +20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000 +-- Iteration 6 -- +4667.000000 4011.000000 83.000000 10.000000 +-- Iteration 7 -- +%-5678.567800 f +-- Iteration 8 -- +1.110000 2.220000 3.330000 4.440000 +===DONE=== + diff --git a/ext/standard/tests/strings/vfprintf_variation6.phpt b/ext/standard/tests/strings/vfprintf_variation6.phpt new file mode 100644 index 0000000000..6b5425d5cf --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation6.phpt @@ -0,0 +1,108 @@ +--TEST-- +Test vfprintf() function : usage variations - float formats with non-float values +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different float formats from the above $format array +// and with non-float values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : float formats and non-float values *** + +-- Iteration 1 -- +2.000000 -2.000000 2.000000 + 123456.000000 f -12346789.000000 12346789.000000 + 123200.0000 20000.0000 -40000.000000 22212.0000 + 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000 + 2.000000 123456.000000 2.000000 -2.000000 +-- Iteration 2 -- +0.000000 +0.000000 0.000000 + 123.000000 f -123.000000 123.000000 + 0.0000 0.0000 123456.000000 0.0000 + 1234.000000 0.000000 0.000000 0.000000 + 0.000000 123.000000 0.000000 0.000000 +-- Iteration 3 -- +1.000000 +1.000000 1.000000 + 1.000000 f 1.000000 1.000000 + 1.0000 1.0000 1.000000 1.0000 + 1.000000 1.000000 1.000000 1.000000 + 1.000000 1.000000 1.000000 1.000000 +-- Iteration 4 -- +1.000000 +1.000000 0.000000 + 1.000000 f 0.000000 1.000000 + 1.0000 0.0000 1.000000 0.0000 + 0.000000 1.000000 1.000000 0.000000 + 0.000000 1.000000 1.000000 1.000000 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation7.phpt b/ext/standard/tests/strings/vfprintf_variation7.phpt new file mode 100644 index 0000000000..a206fd8691 Binary files /dev/null and b/ext/standard/tests/strings/vfprintf_variation7.phpt differ diff --git a/ext/standard/tests/strings/vfprintf_variation8.phpt b/ext/standard/tests/strings/vfprintf_variation8.phpt new file mode 100644 index 0000000000..cda05c4d79 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation8.phpt @@ -0,0 +1,111 @@ +--TEST-- +Test vfprintf() function : usage variations - string formats with non-string values +--FILE-- +"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), + +); + +/* creating dumping file */ +$data_file = dirname(__FILE__) . '/dump.txt'; +if (!($fp = fopen($data_file, 'wt'))) + return; + +// looping to test vfprintf() with different string formats from the above $format array +// and with non-string values from the above $args_array array +$counter = 1; +foreach($args_array as $args) { + fprintf($fp, "\n-- Iteration %d --\n",$counter); + vfprintf($fp, $formats, $args); + $counter++; +} + +fclose($fp); +print_r(file_get_contents($data_file)); +echo "\n"; + +unlink($data_file); + +?> +===DONE=== +--EXPECT-- +*** Testing vfprintf() : string formats and non-string values *** + +-- Iteration 1 -- +2.2 0.2 10.2 + 123456.234 s -1234.6789 1234.6789 + 2123 2765 -27654321000 1234 + 12.000000011111 -12.00000111111 -123456.234 3.33 + 10.2 123456.234 2.2 0.2 +-- Iteration 2 -- +2 -2 2 + 123456 s -12346789 12346789 + 1232 2000 -40000 2221 + 12345780 1211111 -12111111 -12345634 + 2 123456 2 -2 +-- Iteration 3 -- +Array Array Array + Array s Array Array + Arra Arra Array Arra + Array Array Array Array + Array Array Array Array +-- Iteration 4 -- +1 1 + 1 s 1 + 1 0001 0000 + #0 1 $1 _0 + 1 1 1 +===DONE=== diff --git a/ext/standard/tests/strings/vfprintf_variation9.phpt b/ext/standard/tests/strings/vfprintf_variation9.phpt new file mode 100644 index 0000000000..a67c579df4 --- /dev/null +++ b/ext/standard/tests/strings/vfprintf_variation9.phpt @@ -0,0 +1,85 @@ +--TEST-- +Test vfprintf() function : usage variations - char formats with char values +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing vfprintf() : char formats with char values *** + +-- Iteration 1 -- +%c +-- Iteration 2 -- +%c C +-- Iteration 3 -- +%c c, %s C +-- Iteration 4 -- +a %s b b +-- Iteration 5 -- +a %s b b +-- Iteration 6 -- +; %s S + +-- Iteration 7 -- +%. c +-- Iteration 8 -- +A B C D +===DONE=== diff --git a/ext/standard/tests/strings/vsprintf_variation15.phpt b/ext/standard/tests/strings/vsprintf_variation15.phpt index 4026d833d1..8252c2628d 100644 --- a/ext/standard/tests/strings/vsprintf_variation15.phpt +++ b/ext/standard/tests/strings/vsprintf_variation15.phpt @@ -32,7 +32,7 @@ $formats = array( $args_array = array( array(1234567, 01234567, 0 ), array(12345678900, 12345678900, 1234, 12345), - array("1234000", 10e20, 1.2e2), + array("1234000", 10.1234567e5, 1.2e2), array(1, 0, 00, "10_"), array(3, 4, 1, 2) ); @@ -46,8 +46,8 @@ foreach($formats as $format) { $counter++; } -echo "Done"; ?> +===Done=== --EXPECT-- *** Testing vsprintf() : unsigned formats and unsigned values *** @@ -58,11 +58,11 @@ unicode(16) "1234567 342391 0" unicode(23) "2147483647 u 1234 12345" -- Iteration 3 -- -unicode(25) " 1234000 2147483647 120" +unicode(25) " 1234000 1012345 120" -- Iteration 4 -- unicode(10) "#1 0 $0 10" -- Iteration 5 -- unicode(7) "1 2 3 4" -Done +===Done=== diff --git a/ext/standard/tests/strings/vsprintf_variation8.phpt b/ext/standard/tests/strings/vsprintf_variation8.phpt index c0268ab511..79f8c30518 100644 --- a/ext/standard/tests/strings/vsprintf_variation8.phpt +++ b/ext/standard/tests/strings/vsprintf_variation8.phpt @@ -12,12 +12,14 @@ Test vsprintf() function : usage variations - string formats with non-string val * the '$format' and '$args' arguments of the function */ +error_reporting(E_ALL & ~E_NOTICE); + echo "*** Testing vsprintf() : string formats and non-string values ***\n"; // defining array of string formats $formats = '%s %+s %-s - %ls %Ls %4s %-4s + %ls %4s %-4s %10.4s %-10.4s %04s %04.4s %\'#2s %\'2s %\'$2s %\'_2s %3$s %4$s %1$s %2$s'; @@ -28,14 +30,14 @@ $args_array = array( // array of float values array(2.2, .2, 10.2, - 123456.234, 123456.234, -1234.6789, +1234.6789, - 2e10, +2e12, -4e11, 22e+12, + 123456.234, -1234.6789, +1234.6789, + 2.1234567e10, +2.7654321e10, -2.7654321e10, 2.1234567e10, 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, + 123456, -12346789, +12346789, 123200, +20000, -40000, 22212, 12345780, 1211111, -12111111, -12345634, 3, +4, 1,-2 ), @@ -43,14 +45,14 @@ $args_array = array( // different arrays array( array(0), array(1, 2), array(-1, -1), - array("123"), array('123'), array('-123'), 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, 1, true, false, TRUE, FALSE, 0, 1, 1, 0, 1, TRUE, 0, FALSE), @@ -66,72 +68,36 @@ foreach($args_array as $args) { $counter++; } -echo "Done"; ?> ---EXPECTF-- +===DONE=== +--EXPECT-- *** Testing vsprintf() : string formats and non-string values *** -- Iteration 1 -- -unicode(177) "2.2 0.2 10.2 - 123456.234 s -1234.6789 1234.6789 - 2000 2000 -400000000000 2200 +unicode(174) "2.2 0.2 10.2 + 123456.234 -1234.6789 1234.6789 + 2123 2765 -27654321000 2123 12345.78 12.000000011111 -12.00000111111 -123456.234 10.2 123456.234 2.2 0.2" -- Iteration 2 -- -unicode(132) "2 -2 2 - 123456 s -12346789 12346789 +unicode(130) "2 -2 2 + 123456 -12346789 12346789 1232 2000 -40000 2221 12345780 1211111 -12111111 -12345634 2 123456 2 -2" -- Iteration 3 -- - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d - -Notice: Array to string conversion in %s on line %d -unicode(131) "Array Array Array - Array s Array Array +unicode(129) "Array Array Array + Array Array Array Arra Arra Array Arra Array Array Array Array Array Array Array Array" -- Iteration 4 -- -unicode(81) "1 1 - 1 s 1 +unicode(79) "1 1 + 1 1 1 0001 0000 #0 1 $1 _0 1 1 1" -Done +===DONE=== \ No newline at end of file