ICU-11739 Adding ICU4C test for parse long currency.

X-SVN-Rev: 41334
This commit is contained in:
Shane Carr 2018-05-07 21:47:09 +00:00
parent 076cee9ad6
commit 66510b153f
2 changed files with 13 additions and 0 deletions

View file

@ -647,6 +647,7 @@ void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &n
TESTCASE_AUTO(TestFractionalDigitsForCurrency);
TESTCASE_AUTO(TestFormatCurrencyPlural);
TESTCASE_AUTO(Test11868);
TESTCASE_AUTO(Test11739_ParseLongCurrency);
TESTCASE_AUTO(Test10727_RoundingZero);
TESTCASE_AUTO(Test11376_getAndSetPositivePrefix);
TESTCASE_AUTO(Test11475_signRecognition);
@ -8748,6 +8749,17 @@ void NumberFormatTest::Test10727_RoundingZero() {
assertTrue("", dq.isNegative());
}
void NumberFormatTest::Test11739_ParseLongCurrency() {
IcuTestErrorCode status(*this, "Test11739_ParseLongCurrency");
LocalPointer<NumberFormat> nf(NumberFormat::createCurrencyInstance("sr_BA", status));
((DecimalFormat*) nf.getAlias())->applyPattern(u"#,##0.0 ¤¤¤", status);
ParsePosition ppos(0);
CurrencyAmount* result = nf->parseCurrency(u"1.500 амерички долар", ppos);
assertEquals("Should parse to 1500 USD", -1, ppos.getErrorIndex());
assertEquals("Should parse to 1500 USD", 1500LL, result->getNumber().getInt64(status));
assertEquals("Should parse to 1500 USD", u"USD", result->getISOCurrency());
}
void NumberFormatTest::Test11376_getAndSetPositivePrefix() {
{
const UChar USD[] = {0x55, 0x53, 0x44, 0x0};

View file

@ -211,6 +211,7 @@ class NumberFormatTest: public CalendarTimeZoneTest {
void TestFractionalDigitsForCurrency();
void TestFormatCurrencyPlural();
void Test11868();
void Test11739_ParseLongCurrency();
void Test10727_RoundingZero();
void Test11376_getAndSetPositivePrefix();
void Test11475_signRecognition();