X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..6be67b064733ad8f9e904623c29984bb874c1e0c:/icuSources/test/intltest/itrbnfrt.cpp diff --git a/icuSources/test/intltest/itrbnfrt.cpp b/icuSources/test/intltest/itrbnfrt.cpp index 6604f0f5..d038f4f6 100644 --- a/icuSources/test/intltest/itrbnfrt.cpp +++ b/icuSources/test/intltest/itrbnfrt.cpp @@ -1,6 +1,8 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* - * Copyright (C) 1996-2000, International Business Machines Corporation and * + * Copyright (C) 1996-2009, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* */ @@ -12,7 +14,8 @@ #include "itrbnfrt.h" #include "unicode/fmtable.h" -#include "math.h" // fabs +#include // fabs +#include // current macro not in icu1.8.1 #define TESTCASE(id,test) \ @@ -20,7 +23,7 @@ name = #test; \ if (exec) { \ logln(#test "---"); \ - logln((UnicodeString)""); \ + logln(); \ test(); \ } \ break @@ -41,7 +44,7 @@ void RbnfRoundTripTest::runIndexedTest(int32_t index, UBool exec, const char* &n TESTCASE(8, TestDutchSpelloutRT); TESTCASE(9, TestJapaneseSpelloutRT); TESTCASE(10, TestRussianSpelloutRT); - TESTCASE(11, TestGreekSpelloutRT); + TESTCASE(11, TestPortugueseSpelloutRT); #else TESTCASE(0, TestRBNFDisabled); #endif @@ -64,7 +67,7 @@ RbnfRoundTripTest::TestEnglishSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getUS(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -12345678, 12345678); } @@ -82,7 +85,7 @@ RbnfRoundTripTest::TestDurationsRT() = new RuleBasedNumberFormat(URBNF_DURATION, Locale::getUS(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, 0, 12345678); } @@ -100,7 +103,7 @@ RbnfRoundTripTest::TestSpanishSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("es", "es"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -12345678, 12345678); } @@ -118,7 +121,7 @@ RbnfRoundTripTest::TestFrenchSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getFrance(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -12345678, 12345678); } @@ -136,7 +139,7 @@ RbnfRoundTripTest::TestSwissFrenchSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("fr", "CH"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -12345678, 12345678); } @@ -154,7 +157,7 @@ RbnfRoundTripTest::TestItalianSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getItalian(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -999999, 999999); } @@ -172,7 +175,7 @@ RbnfRoundTripTest::TestGermanSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getGermany(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, 0, 12345678); } @@ -190,7 +193,7 @@ RbnfRoundTripTest::TestSwedishSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("sv", "SE"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, 0, 12345678); } @@ -208,7 +211,7 @@ RbnfRoundTripTest::TestDutchSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("nl", "NL"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, -12345678, 12345678); } @@ -226,7 +229,7 @@ RbnfRoundTripTest::TestJapaneseSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale::getJapan(), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, 0, 12345678); } @@ -244,7 +247,7 @@ RbnfRoundTripTest::TestRussianSpelloutRT() = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("ru", "RU"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { doTest(formatter, 0, 12345678); } @@ -252,19 +255,19 @@ RbnfRoundTripTest::TestRussianSpelloutRT() } /** - * Perform an exhaustive round-trip test on the Greek spellout rules + * Perform an exhaustive round-trip test on the Portuguese spellout rules */ void -RbnfRoundTripTest::TestGreekSpelloutRT() +RbnfRoundTripTest::TestPortugueseSpelloutRT() { UErrorCode status = U_ZERO_ERROR; RuleBasedNumberFormat* formatter - = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("el", "GR"), status); + = new RuleBasedNumberFormat(URBNF_SPELLOUT, Locale("pt", "BR"), status); if (U_FAILURE(status)) { - errln("failed to construct formatter"); + errcheckln(status, "failed to construct formatter - %s", u_errorName(status)); } else { - doTest(formatter, 0, 12345678); + doTest(formatter, -12345678, 12345678); } delete formatter; }