/*
*******************************************************************************
- * Copyright (C) 1996-2000, International Business Machines Corporation and *
+ * Copyright (C) 1996-2009, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
#include "itrbnfrt.h"
#include "unicode/fmtable.h"
-#include "math.h" // fabs
+#include <math.h> // fabs
+#include <stdio.h>
// current macro not in icu1.8.1
#define TESTCASE(id,test) \
name = #test; \
if (exec) { \
logln(#test "---"); \
- logln((UnicodeString)""); \
+ logln(); \
test(); \
} \
break
TESTCASE(8, TestDutchSpelloutRT);
TESTCASE(9, TestJapaneseSpelloutRT);
TESTCASE(10, TestRussianSpelloutRT);
- TESTCASE(11, TestGreekSpelloutRT);
+ TESTCASE(11, TestPortugueseSpelloutRT);
#else
TESTCASE(0, TestRBNFDisabled);
#endif
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
= 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);
}
}
/**
- * 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;
}