From 72254a10bc0626274d82622b296547aaa282aab1 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 07:33:16 +0100 Subject: [PATCH 1/8] add tests for NumberFormat::FORMAT_NUMBER --- tests/data/Style/NumberFormat.php | 52 +++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index 0124c32448..b134f9a047 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -1,5 +1,7 @@ Date: Sat, 5 Feb 2022 07:39:48 +0100 Subject: [PATCH 2/8] add tests for NumberFormat::FORMAT_NUMBER_00 --- tests/data/Style/NumberFormat.php | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index b134f9a047..cadd328dac 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -591,4 +591,64 @@ '1.9', NumberFormat::FORMAT_NUMBER, ], + [ + '0.00', + '0', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '1.00', + '1', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '1.11', + '1.111', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '1.11', + '1.114', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '1.12', + '1.115', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '1.12', + '1.119', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '0.00', + '-0', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '-1.00', + '-1', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '-1.11', + '-1.111', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '-1.11', + '-1.114', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '-1.12', + '-1.115', + NumberFormat::FORMAT_NUMBER_00, + ], + [ + '-1.12', + '-1.119', + NumberFormat::FORMAT_NUMBER_00, + ], ]; From cf43df38e7ede2e80d22b8fbde1a45319f43e774 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 12:56:58 +0100 Subject: [PATCH 3/8] add tests for FORMAT_NUMBER_COMMA_SEPARATED1 --- tests/data/Style/NumberFormat.php | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index cadd328dac..a52e77a656 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -651,4 +651,64 @@ '-1.119', NumberFormat::FORMAT_NUMBER_00, ], + [ + '0.00', + '0', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '1,000.00', + '1000', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '1,111.11', + '1111.111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '1,111.11', + '1111.114', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '1,111.12', + '1111.115', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '1,111.12', + '1111.119', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '0.00', + '-0', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '-1,111.00', + '-1111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '-1,111.11', + '-1111.111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '-1,111.11', + '-1111.114', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '-1,111.12', + '-1111.115', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], + [ + '-1,111.12', + '-1111.119', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, + ], ]; From 782f6fa4cef3d98893eb95f75da0282622dde352 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 13:14:16 +0100 Subject: [PATCH 4/8] add tests for FORMAT_NUMBER_COMMA_SEPARATED2 --- tests/data/Style/NumberFormat.php | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index a52e77a656..1e2f6e931d 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -711,4 +711,64 @@ '-1111.119', NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1, ], + [ + '0.00 ', + '0', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '1,000.00 ', + '1000', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '1,111.11 ', + '1111.111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '1,111.11 ', + '1111.114', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '1,111.12 ', + '1111.115', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '1,111.12 ', + '1111.119', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '0.00 ', + '-0', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '-1,111.00 ', + '-1111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '-1,111.11 ', + '-1111.111', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '-1,111.11 ', + '-1111.114', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '-1,111.12 ', + '-1111.115', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], + [ + '-1,111.12 ', + '-1111.119', + NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, + ], ]; From 37121116f8705cbd3970366da519549f98a47c45 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 16:43:49 +0100 Subject: [PATCH 5/8] add tests for FORMAT_CURRENCY_USD_SIMPLE --- tests/data/Style/NumberFormat.php | 61 +++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index 1e2f6e931d..d88b3676b8 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -771,4 +771,65 @@ '-1111.119', NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED2, ], + // Tests for FORMAT_PERCENTAGE, FORMAT_PERCENTAGE_00 currently fail. Fix & tests will be provided in #2555 + [ + '$0.00 ', + '0', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,000.00 ', + '1000', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.11 ', + '1111.111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.11 ', + '1111.114', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.12 ', + '1111.115', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.12 ', + '1111.119', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$0.00 ', + '-0', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.00 ', + '-1111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.11 ', + '-1111.111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.11 ', + '-1111.114', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.12 ', + '-1111.115', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.12 ', + '-1111.119', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], ]; From fbc378125d6e1b629c7de2b5a83eae1835f26275 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 16:47:29 +0100 Subject: [PATCH 6/8] add tests for FORMAT_CURRENCY_USD --- tests/data/Style/NumberFormat.php | 60 +++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index d88b3676b8..9be47da145 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -832,4 +832,64 @@ '-1111.119', NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, ], + [ + '$0 ', + '0', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,000 ', + '1000', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,111 ', + '1111.1', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,111 ', + '1111.4', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,112 ', + '1111.5', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,112 ', + '1111.9', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$0 ', + '-0', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111.1', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111.4', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,112 ', + '-1111.5', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,112 ', + '-1111.9', + NumberFormat::FORMAT_CURRENCY_USD, + ], ]; From e5f8d56f899065bd6898108569251d1aa48b23d5 Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 16:53:09 +0100 Subject: [PATCH 7/8] add tests for FORMAT_CURRENCY_EUR, FORMAT_CURRENCY_EUR_SIMPLE --- tests/data/Style/NumberFormat.php | 240 ++++++++++++++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index 9be47da145..de9d4404ac 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -892,4 +892,244 @@ '-1111.9', NumberFormat::FORMAT_CURRENCY_USD, ], + [ + '$0.00 ', + '0', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,000.00 ', + '1000', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.11 ', + '1111.111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.11 ', + '1111.114', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.12 ', + '1111.115', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$1,111.12 ', + '1111.119', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$0.00 ', + '-0', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.00 ', + '-1111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.11 ', + '-1111.111', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.11 ', + '-1111.114', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.12 ', + '-1111.115', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$-1,111.12 ', + '-1111.119', + NumberFormat::FORMAT_CURRENCY_USD_SIMPLE, + ], + [ + '$0 ', + '0', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,000 ', + '1000', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,111 ', + '1111.1', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,111 ', + '1111.4', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,112 ', + '1111.5', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$1,112 ', + '1111.9', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$0 ', + '-0', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111.1', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,111 ', + '-1111.4', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,112 ', + '-1111.5', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '$-1,112 ', + '-1111.9', + NumberFormat::FORMAT_CURRENCY_USD, + ], + [ + '0.00 €', + '0', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '1,000.00 €', + '1000', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '1,111.11 €', + '1111.111', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '1,111.11 €', + '1111.114', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '1,111.12 €', + '1111.115', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '1,111.12 €', + '1111.119', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '0.00 €', + '-0', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '-1,111.00 €', + '-1111', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '-1,111.11 €', + '-1111.111', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '-1,111.11 €', + '-1111.114', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '-1,111.12 €', + '-1111.115', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '-1,111.12 €', + '-1111.119', + NumberFormat::FORMAT_CURRENCY_EUR_SIMPLE, + ], + [ + '0 €', + '0', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '1,000 €', + '1000', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '1,111 €', + '1111.1', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '1,111 €', + '1111.4', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '1,112 €', + '1111.5', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '1,112 €', + '1111.9', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '0 €', + '-0', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '-1,111 €', + '-1111', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '-1,111 €', + '-1111.1', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '-1,111 €', + '-1111.4', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '-1,112 €', + '-1111.5', + NumberFormat::FORMAT_CURRENCY_EUR, + ], + [ + '-1,112 €', + '-1111.9', + NumberFormat::FORMAT_CURRENCY_EUR, + ], ]; From 0a9bac2188b97007ba7588b3425b9b84ef03b7ad Mon Sep 17 00:00:00 2001 From: Sebastian Nohn Date: Sat, 5 Feb 2022 18:41:05 +0100 Subject: [PATCH 8/8] add tests for FORMAT_ACCOUNTING_EUR, FORMAT_ACCOUNTING_USD --- tests/data/Style/NumberFormat.php | 120 ++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/tests/data/Style/NumberFormat.php b/tests/data/Style/NumberFormat.php index de9d4404ac..02ef1b809a 100644 --- a/tests/data/Style/NumberFormat.php +++ b/tests/data/Style/NumberFormat.php @@ -1132,4 +1132,124 @@ '-1111.9', NumberFormat::FORMAT_CURRENCY_EUR, ], + [ + ' $ - ', + '0', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ 1,000.00 ', + '1000', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ 1,111.11 ', + '1111.111', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ 1,111.11 ', + '1111.114', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ 1,111.12 ', + '1111.115', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ 1,111.12 ', + '1111.119', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ - ', + '-0', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ (1,111.00)', + '-1111', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ (1,111.11)', + '-1111.111', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ (1,111.11)', + '-1111.114', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ (1,111.12)', + '-1111.115', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' $ (1,111.12)', + '-1111.119', + NumberFormat::FORMAT_ACCOUNTING_USD, + ], + [ + ' € - ', + '0', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € 1,000.00 ', + '1000', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € 1,111.11 ', + '1111.111', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € 1,111.11 ', + '1111.114', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € 1,111.12 ', + '1111.115', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € 1,111.12 ', + '1111.119', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € - ', + '-0', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € (1,111.00)', + '-1111', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € (1,111.11)', + '-1111.111', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € (1,111.11)', + '-1111.114', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € (1,111.12)', + '-1111.115', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], + [ + ' € (1,111.12)', + '-1111.119', + NumberFormat::FORMAT_ACCOUNTING_EUR, + ], ];