From 364cf9ae6b24ba2d7a352b6ee602b9db1bb8c827 Mon Sep 17 00:00:00 2001 From: andy wharmby Date: Sat, 17 Jan 2009 22:52:12 +0000 Subject: [PATCH] New money_format() tests. Tested on Windows, Linux and Linux 64 bit --- .../tests/strings/money_format_basic1.phpt | 87 ++++++++ .../tests/strings/money_format_basic2.phpt | 87 ++++++++ .../tests/strings/money_format_basic3.phpt | 87 ++++++++ .../tests/strings/money_format_error.phpt | 51 +++++ .../strings/money_format_variation1.phpt | 181 +++++++++++++++++ .../strings/money_format_variation2.phpt | 189 ++++++++++++++++++ 6 files changed, 682 insertions(+) create mode 100644 ext/standard/tests/strings/money_format_basic1.phpt create mode 100644 ext/standard/tests/strings/money_format_basic2.phpt create mode 100644 ext/standard/tests/strings/money_format_basic3.phpt create mode 100644 ext/standard/tests/strings/money_format_error.phpt create mode 100644 ext/standard/tests/strings/money_format_variation1.phpt create mode 100644 ext/standard/tests/strings/money_format_variation2.phpt diff --git a/ext/standard/tests/strings/money_format_basic1.phpt b/ext/standard/tests/strings/money_format_basic1.phpt new file mode 100644 index 0000000000..f46315196b --- /dev/null +++ b/ext/standard/tests/strings/money_format_basic1.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test money_format() function : basic functionality using national currency symbols +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing money_format() : basic functionality using national currency symbols*** + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +Format values with 14 positions, 8 digits to left, 2 to right using national format +unicode(15) " $ 1,234.57" +unicode(15) "-$ 1,234.57" +Format again but with ( for negative values +unicode(15) " $ 1,234.57" +unicode(16) "($ 1,234.57)" +Format with 0 for padding character +unicode(15) " $000001,234.57" +unicode(15) "-$000001,234.57" +Format again with * for padding character +unicode(15) " $*****1,234.57" +unicode(15) "-$*****1,234.57" +Format again but disable grouping character +unicode(14) " $****1234.57" +unicode(14) " -$****1234.57" +Format again suppress currency symbol +unicode(14) " *****1,234.57" +unicode(14) "-*****1,234.57" + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +===DONE=== diff --git a/ext/standard/tests/strings/money_format_basic2.phpt b/ext/standard/tests/strings/money_format_basic2.phpt new file mode 100644 index 0000000000..83603a19d4 --- /dev/null +++ b/ext/standard/tests/strings/money_format_basic2.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test money_format() function : basic functionality using international currency symbols +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing money_format() : basic functionality using international currency symbols*** + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +Format with 14 positions, 8 digits to left, 2 to right using national format +unicode(18) " USD 1,234.57" +unicode(18) "-USD 1,234.57" +Format with ( for negative values +unicode(18) " USD 1,234.57" +unicode(19) "(USD 1,234.57)" +Format with 0 for padding character +unicode(18) " USD 000001,234.57" +unicode(18) "-USD 000001,234.57" +Format with * for padding character +unicode(18) " USD *****1,234.57" +unicode(18) "-USD *****1,234.57" +Format again but disable grouping character +unicode(16) " USD ****1234.57" +unicode(16) "-USD ****1234.57" +Format again but suppress currency symbol +unicode(14) " *****1,234.57" +unicode(14) "-*****1,234.57" + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +===DONE=== diff --git a/ext/standard/tests/strings/money_format_basic3.phpt b/ext/standard/tests/strings/money_format_basic3.phpt new file mode 100644 index 0000000000..54ee7c0fe9 --- /dev/null +++ b/ext/standard/tests/strings/money_format_basic3.phpt @@ -0,0 +1,87 @@ +--TEST-- +Test money_format() function : basic functionality using national currency symbols and de_DE locale +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing money_format() : basic functionality using national currency symbols and de_DE locale*** + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +Format values with 14 positions, 8 digits to left, 2 to right using national format +unicode(18) " 1.234,57 EUR" +unicode(18) "- 1.234,57 EUR" +Format again but with ( for negative values +unicode(18) " 1.234,57 EUR" +unicode(19) "( 1.234,57 EUR)" +Format with 0 for padding character +unicode(18) " 000001.234,57 EUR" +unicode(18) "-000001.234,57 EUR" +Format again with * for padding character +unicode(18) " *****1.234,57 EUR" +unicode(18) "-*****1.234,57 EUR" +Format again but disable grouping character +unicode(16) " ****1234,57 EUR" +unicode(16) "-****1234,57 EUR" +Format again suppress currency symbol +unicode(14) " *****1.234,57" +unicode(14) "-*****1.234,57" + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/money_format_error.phpt b/ext/standard/tests/strings/money_format_error.phpt new file mode 100644 index 0000000000..fac89d1b55 --- /dev/null +++ b/ext/standard/tests/strings/money_format_error.phpt @@ -0,0 +1,51 @@ +--TEST-- +Test money_format() function : error conditions +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +*** Testing money_format() : error conditions *** + +-- Testing money_format() function with no arguments -- + +Warning: money_format() expects exactly 2 parameters, 0 given in %s on line %d +NULL + +-- Testing money_format() function with insufficient arguments -- + +Warning: money_format() expects exactly 2 parameters, 1 given in %s on line %d +NULL + +-- Testing money_format() function with more than expected no. of arguments -- + +Warning: money_format() expects exactly 2 parameters, 3 given in %s on line %d +NULL +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/money_format_variation1.phpt b/ext/standard/tests/strings/money_format_variation1.phpt new file mode 100644 index 0000000000..ec3f583a1b --- /dev/null +++ b/ext/standard/tests/strings/money_format_variation1.phpt @@ -0,0 +1,181 @@ +--TEST-- +Test money_format() function : usage variations - test values for $format argument +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +*** Testing money_format() function: with unexpected inputs for 'format' argument *** +-- Iteration 1 -- +unicode(1) "0" +-- Iteration 2 -- +unicode(1) "1" +-- Iteration 3 -- +unicode(3) "255" +-- Iteration 4 -- +unicode(3) "256" +-- Iteration 5 -- +unicode(10) "2147483647" +-- Iteration 6 -- +unicode(11) "-2147483648" +-- Iteration 7 -- +unicode(3) "0.5" +-- Iteration 8 -- +unicode(5) "-20.5" +-- Iteration 9 -- +unicode(12) "101234567000" +-- Iteration 10 -- + +Warning: money_format() expects parameter 1 to be binary string, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: money_format() expects parameter 1 to be binary string, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: money_format() expects parameter 1 to be binary string, array given in %s on line %d +NULL +-- Iteration 13 -- +unicode(1) "1" +-- Iteration 14 -- +unicode(0) "" +-- Iteration 15 -- +unicode(1) "1" +-- Iteration 16 -- +unicode(0) "" +-- Iteration 17 -- +unicode(0) "" +-- Iteration 18 -- +unicode(0) "" +-- Iteration 19 -- +unicode(4) "abcd" +-- Iteration 20 -- +unicode(4) "abcd" +-- Iteration 21 -- +unicode(5) "0x12f" +-- Iteration 22 -- +unicode(18) " *****1,234.56abcd" +-- Iteration 23 -- + +Warning: money_format() expects parameter 1 to be binary string, object given in %s on line %d +NULL +-- Iteration 24 -- +unicode(17) " sample object " +-- Iteration 25 -- + +Warning: money_format() expects parameter 1 to be binary string, resource given in %s on line %d +NULL +-- Iteration 26 -- +unicode(0) "" +-- Iteration 27 -- +unicode(0) "" + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +===DONE=== \ No newline at end of file diff --git a/ext/standard/tests/strings/money_format_variation2.phpt b/ext/standard/tests/strings/money_format_variation2.phpt new file mode 100644 index 0000000000..a1a2d292ca --- /dev/null +++ b/ext/standard/tests/strings/money_format_variation2.phpt @@ -0,0 +1,189 @@ +--TEST-- +Test money_format() function : usage variations - test values for $number argument +--SKIPIF-- + +--FILE-- + +===DONE=== +--EXPECTF-- +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +*** Testing money_format() function: with unexpected inputs for 'number' argument *** +-- Iteration 1 -- +unicode(18) " USD 0.00" +-- Iteration 2 -- +unicode(18) " USD 1.00" +-- Iteration 3 -- +unicode(18) " USD 255.00" +-- Iteration 4 -- +unicode(18) " USD 256.00" +-- Iteration 5 -- +unicode(21) " USD 2,147,483,647.00" +-- Iteration 6 -- +unicode(21) "-USD 2,147,483,648.00" +-- Iteration 7 -- +unicode(18) " USD 10.50" +-- Iteration 8 -- +unicode(18) "-USD 20.50" +-- Iteration 9 -- +unicode(23) " USD 101,234,567,000.00" +-- Iteration 10 -- + +Warning: money_format() expects parameter 2 to be double, array given in %s on line %d +NULL +-- Iteration 11 -- + +Warning: money_format() expects parameter 2 to be double, array given in %s on line %d +NULL +-- Iteration 12 -- + +Warning: money_format() expects parameter 2 to be double, array given in %s on line %d +NULL +-- Iteration 13 -- +unicode(18) " USD 1.00" +-- Iteration 14 -- +unicode(18) " USD 0.00" +-- Iteration 15 -- +unicode(18) " USD 1.00" +-- Iteration 16 -- +unicode(18) " USD 0.00" +-- Iteration 17 -- +unicode(18) " USD 0.00" +-- Iteration 18 -- +unicode(18) " USD 0.00" +-- Iteration 19 -- + +Warning: money_format() expects parameter 2 to be double, Unicode string given in %s on line %d +NULL +-- Iteration 20 -- + +Warning: money_format() expects parameter 2 to be double, Unicode string given in %s on line %d +NULL +-- Iteration 21 -- +unicode(18) " USD 303.00" +-- Iteration 22 -- + +Warning: money_format() expects parameter 2 to be double, Unicode string given in %s on line %d +NULL +-- Iteration 23 -- + +Warning: money_format() expects parameter 2 to be double, object given in %s on line %d +NULL +-- Iteration 24 -- + +Warning: money_format() expects parameter 2 to be double, object given in %s on line %d +NULL +-- Iteration 25 -- + +Warning: money_format() expects parameter 2 to be double, resource given in %s on line %d +NULL +-- Iteration 26 -- +unicode(18) " USD 0.00" +-- Iteration 27 -- +unicode(18) " USD 0.00" + +Deprecated: setlocale(): deprecated in Unicode mode, please use ICU locale functions in %s on line %d +===DONE=== \ No newline at end of file -- 2.50.1