From 2627d76fbe63fea6202a6b921ab8049294dc9a2a Mon Sep 17 00:00:00 2001 From: Norbert Runge Date: Fri, 18 May 2018 20:17:33 +0000 Subject: [PATCH] ICU-11640 Add test for triple currency digit prefix. X-SVN-Rev: 41412 --- icu4c/source/test/intltest/numfmtst.cpp | 16 ++++++++++++++++ icu4c/source/test/intltest/numfmtst.h | 1 + 2 files changed, 17 insertions(+) diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 48bce4801a..5bacc440c0 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -211,6 +211,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n TESTCASE_AUTO(Test11647_PatternCurrencySymbols); TESTCASE_AUTO(Test11913_BigDecimal); TESTCASE_AUTO(Test11020_RoundingInScientificNotation); + TESTCASE_AUTO(Test11640_TripleCurrencySymbol); TESTCASE_AUTO_END; } @@ -9025,4 +9026,19 @@ void NumberFormatTest::Test11020_RoundingInScientificNotation() { fmt.format(12301.2, result); assertEquals("Rounding increment should be applied after magnitude scaling", u"1,25E4", result); } +void NumberFormatTest::Test11640_TripleCurrencySymbol() { + IcuTestErrorCode status(*this, "PercentageRounding"); + UnicodeString actual; + DecimalFormat *dFormat = new DecimalFormat("¤¤¤ 0", status); + if (U_FAILURE(status)) { + dataerrln("Failure creating DecimalFormat %s", u_errorName(status)); + return; + } + dFormat->setCurrency(u"USD"); + UnicodeString result; + dFormat->getPositivePrefix(result); + assertEquals("Tryple-currency should give long name on getPositivePrefix", + "US dollars ", result); +} + #endif /* #if !UCONFIG_NO_FORMATTING */ diff --git a/icu4c/source/test/intltest/numfmtst.h b/icu4c/source/test/intltest/numfmtst.h index 82ee0546cc..0e17655e19 100644 --- a/icu4c/source/test/intltest/numfmtst.h +++ b/icu4c/source/test/intltest/numfmtst.h @@ -275,6 +275,7 @@ class NumberFormatTest: public CalendarTimeZoneTest { void Test11647_PatternCurrencySymbols(); void Test11913_BigDecimal(); void Test11020_RoundingInScientificNotation(); + void Test11640_TripleCurrencySymbol(); private: UBool testFormattableAsUFormattable(const char *file, int line, Formattable &f);