Lines Matching refs:UnicodeString
30 virtual UnicodeString& format( double number,
31 UnicodeString& toAppendTo,
39 virtual UnicodeString& format(const Formattable& obj,
40 UnicodeString& toAppendTo,
48 virtual UnicodeString& format( double /* number */,
49 UnicodeString& toAppendTo,
62 virtual void parse( const UnicodeString& /* text */,
69 virtual void parse( const UnicodeString& text,
78 virtual UnicodeString& format(int32_t,
79 UnicodeString& foo,
83 virtual UnicodeString& format(int64_t,
84 UnicodeString& foo,
88 virtual void applyPattern(const UnicodeString&, UParseError&, UErrorCode&){
103 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break
108 // if (exec) logln((UnicodeString)"TestSuite NumberFormatRegressionTest");
177 NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const Locale& l, UBool possibleDataError)
181 dataerrln(UnicodeString("FAIL: ", "") + msg
182 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l.getName(),""));
184 errcheckln(status, UnicodeString("FAIL: ", "") + msg
185 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l.getName(),""));
194 NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, const char *l, UBool possibleDataError)
198 dataerrln(UnicodeString("FAIL: ", "") + msg
199 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l, ""));
201 errcheckln(status, UnicodeString("FAIL: ", "") + msg
202 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), "") + UnicodeString(l, ""));
211 NumberFormatRegressionTest::failure(UErrorCode status, const UnicodeString& msg, UBool possibleDataError)
215 dataerrln(UnicodeString("FAIL: ", "") + msg
216 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), ""));
218 errcheckln(status, UnicodeString("FAIL: ", "") + msg
219 + UnicodeString(" failed, error ", "") + UnicodeString(u_errorName(status), ""));
228 * Convert Java-style strings with \u Unicode escapes into UnicodeString objects
230 inline UnicodeString str(const char *input)
287 UnicodeString sBuf1;
289 logln(UnicodeString("d = ") + d);
294 UnicodeString sBuf2;
321 UnicodeString buf1;
322 UnicodeString buf2;
324 logln(UnicodeString("format(") + n + ") = " +
326 symbols->setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, UnicodeString((UChar)0x70)); // change value of field
327 logln(UnicodeString("format(") + n + ") = " +
347 UnicodeString buffer;
370 UnicodeString sBuf;
396 logln(UnicodeString(" VALUE ") + returnfloat);
405 UnicodeString stringValue;
416 errln(UnicodeString("FAIL: expected ") + returnfloat + ", got " + floatResult + " (" + stringValue+")");
432 UnicodeString str;
433 format->parse(UnicodeString("0"), result, status);
478 UnicodeString out;
482 UnicodeString expected("0.0016");
514 UnicodeString temp;
520 nf->applyLocalizedPattern(UnicodeString("###,00;(###,00)"), status);
538 UnicodeString pat(patChars, 19, 19);
543 UnicodeString buffer;
545 //if (buffer != UnicodeString("1\u00a0234,00"))
549 UnicodeString cc(c, 8, 8);
558 UnicodeString cc1(c1, 10, 10);
587 df->parse(UnicodeString("123.55456"), d, pos);
589 UnicodeString dstr;
594 if (dstr != UnicodeString("123.55456")) {
595 errln(UnicodeString("Result -> ") + d.getDouble());
642 df->applyPattern(UnicodeString("#.#.#"), status);
645 UnicodeString temp;
681 UnicodeString sb;
683 logln(UnicodeString("d = ") + d);
698 logln(UnicodeString("d = ") + d);
707 UnicodeString sb;
736 UnicodeString str("0.1234");
743 logln(UnicodeString("") + d1);
745 errln(UnicodeString("Bug 4095713 test failed, new double value : ") + d2.getDouble());
766 /*UnicodeString str = Long.toString(Long.MIN_VALUE);
782 DecimalFormat *dfFoo = new DecimalFormat(UnicodeString("000"), status);
793 UnicodeString temp;
794 if (dfFoo->toPattern(temp) != UnicodeString("#0000"))
801 if (dfFoo->toPattern(temp) != UnicodeString("#000"))
808 if (dfFoo->toPattern(temp) != UnicodeString("#000"))
815 if (dfFoo->toPattern(temp) != UnicodeString("#0000"))
850 UnicodeString decSep = sym->getSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol);
851 UnicodeString monSep = sym->getSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol);
858 UnicodeString str;
861 UnicodeString monStr("1x23");
863 UnicodeString decStr("1x23");
866 logln(UnicodeString("OK: 1.23 -> \"") + str + "\" contains \"" +
869 errln(UnicodeString("FAIL: 1.23 -> \"") + str + "\", should contain \"" +
882 UnicodeString tempString;
898 UnicodeString expectedDefault(chars1, 10, 10);
899 UnicodeString expectedCurrency(chars2, 10, 10);
900 UnicodeString expectedPercent(chars3, 10, 10);
917 errln(UnicodeString("Failed:") +
931 errln(UnicodeString("Failed:") +
946 errln(UnicodeString("Failed:") +
959 UnicodeString tempString;
974 UnicodeString expectedDefault(chars1, 10, 10);
975 UnicodeString expectedCurrency(chars2, 10, 10);
976 UnicodeString expectedPercent(chars3, 10, 10);
989 errln(UnicodeString("Failed:") +
1003 errln(UnicodeString("Failed:") +
1017 errln(UnicodeString("Failed:") +
1031 UnicodeString tempString;
1037 UnicodeString expectedDefault("-5.789,988");
1038 UnicodeString expectedCurrency("5.789,99\\u00A0DM");
1039 UnicodeString expectedPercent("-578.999\\u00A0%");
1058 errln(UnicodeString("Failed:") +
1072 errln(UnicodeString("Failed:") +
1086 errln(UnicodeString("Failed:") +
1099 UnicodeString tempString;
1105 UnicodeString expectedDefault("-5.789,988");
1106 UnicodeString expectedCurrency("-IT\\u20A4\\u00A05.790", -1, US_INV);
1107 UnicodeString expectedPercent("-578.999%");
1123 errln(UnicodeString("Failed:") +
1137 errln(UnicodeString("Failed:") +
1151 errln(UnicodeString("Failed:") +
1166 UnicodeString s("12.4");
1190 void NumberFormatRegressionTest::roundingTest(DecimalFormat *df, double x, UnicodeString& expected)
1192 UnicodeString out;
1195 logln(UnicodeString("") + x + " formats with 1 fractional digits to " + out);
1214 UnicodeString temp;
1240 UnicodeString tempString;
1243 if (tempString != UnicodeString("3,456.78 p'ieces"))
1275 DecimalFormat *fmt = new DecimalFormat(UnicodeString("000.0#0"), status);
1277 errln(UnicodeString("Bug 4099404 failed applying illegal pattern \"000.0#0\""));
1284 fmt = new DecimalFormat(UnicodeString("0#0.000"), status);
1299 DecimalFormat *sdf = new DecimalFormat(UnicodeString("#,##0"), status);
1317 DecimalFormat *fmt = new DecimalFormat(UnicodeString("#,#00.00"), status);
1325 fmt->parse(UnicodeString("abc3"), num, status);
1327 errln(UnicodeString("Bug 4052223 failed : can't parse string \"a\". Got ") /*+ num*/);
1341 UnicodeString currency(fmt->getSymbol(DecimalFormatSymbols::kCurrencySymbol));
1342 UnicodeString intlCurrency(fmt->getSymbol(DecimalFormatSymbols::kIntlCurrencySymbol));
1343 UnicodeString monDecSeparator(fmt->getSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol));
1344 if (currency == UnicodeString("") ||
1345 intlCurrency == UnicodeString("") ||
1346 monDecSeparator == UnicodeString(""))
1350 UnicodeString monDecSeparatorStr;
1352 logln((UnicodeString)"Before set ==> Currency : " + currency +(UnicodeString)" Intl Currency : " + intlCurrency + (UnicodeString)" Monetary Decimal Separator : " + monDecSeparatorStr);
1353 fmt->setSymbol(DecimalFormatSymbols::kCurrencySymbol, UnicodeString("XYZ"));
1354 fmt->setSymbol(DecimalFormatSymbols::kIntlCurrencySymbol, UnicodeString("ABC"));
1355 fmt->setSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol, UnicodeString((UChar)0x002A/*'*'*/));
1359 if (currency != UnicodeString("XYZ") ||
1360 intlCurrency != UnicodeString("ABC") ||
1361 monDecSeparator != UnicodeString((UChar)0x002A/*'*'*/)) {
1377 DecimalFormat *fmt = new DecimalFormat(UnicodeString("#,##0.00"), status);
1379 UnicodeString formatted;
1384 errln(UnicodeString("Format 1234.5 failed. Begin index: ") /*+ field.getBeginIndex() + " End index: " + field.getEndIndex()*/);
1408 UnicodeString text("1.222,111");
1415 UnicodeString temp;
1419 if (temp != UnicodeString("1.222"))
1422 text = UnicodeString("1.222x111");
1428 if (temp != UnicodeString("1.222"))
1449 UnicodeString buffer;
1450 UnicodeString temp;
1460 if (buffer != UnicodeString("-0")) // Corrected; see 4147706
1461 errln(UnicodeString("") + d1 + " is formatted as " + buffer);
1464 if (buffer != UnicodeString("-0")) // Corrected; see 4147706
1465 errln(UnicodeString("") + d2 + " is formatted as " + buffer);
1483 UnicodeString text("x");
1486 UnicodeString temp;
1491 errln(UnicodeString("Test Failed: \"") + text + "\" is parsed as " /*+ num*/);
1494 df = new DecimalFormat(UnicodeString("$###.00"), status);
1496 df->parse(UnicodeString("$"), num, pos2);
1498 errln(UnicodeString("Test Failed: \"$\" is parsed as ") /*+ num*/);
1517 UnicodeString text("time 10:x");
1522 errln(UnicodeString("Should return null but got : ") /*+ result*/); // Should be null; it isn't
1551 UnicodeString temp;
1559 logln(UnicodeString("expected: ") + buf);
1577 UnicodeString bar(foo, 1, 1);
1579 UnicodeString temp;
1580 UnicodeString buffer;
1591 if (buffer != UnicodeString("-0")) // Corrected; see 4147706
1592 errln(/*d + */UnicodeString(" is formatted as ") + buffer);
1656 UnicodeString pattern = numPat.getString(status);
1660 UnicodeString foo(fo, 1, 1);
1664 errln(UnicodeString("Currency format for ") + UnicodeString(locales[i].getName()) +
1675 UnicodeString result1;
1685 UnicodeString bar(ba, 1, 1);
1693 UnicodeString buf(pattern);
1726 UnicodeString result2;
1730 errln("Results for " + (UnicodeString)(locales[i].getName()) + " differ: " +
1757 UnicodeString temp;
1759 UnicodeString rateString;
1762 if (rateString != UnicodeString("012.34"))
1771 if (rateString != UnicodeString("+012.34%"))
1786 UnicodeString f;
1789 if (f == UnicodeString("9.02"))
1796 if (f == UnicodeString(".00"))
1831 UnicodeString DATA [] = {
1833 UnicodeString("#.00"), UnicodeString("1.20"),
1834 UnicodeString("0.00"), UnicodeString("1.20"),
1835 UnicodeString("00.00"), UnicodeString("01.20"),
1836 UnicodeString("#0.0#"), UnicodeString("1.2"),
1837 UnicodeString("#0.00"), UnicodeString("1.20")
1841 UnicodeString result;
1869 DecimalFormat *f = new DecimalFormat(UnicodeString(""), syms, status);
1871 UnicodeString s;
1874 if (s != UnicodeString("123.456"))
1878 if (s != UnicodeString("-123.456"))
1891 UnicodeString str("12345.67");
1926 UnicodeString PATS [] = {
1927 UnicodeString("#.00 'num''ber'"), UnicodeString("''#.00''")
1933 UnicodeString out;
1936 UnicodeString pat;
1945 UnicodeString out2;
1947 UnicodeString pat2;
1960 logln(UnicodeString("Ok ") + pi + " x \"" + PATS[i] + "\" -> \"" +
1965 errln(UnicodeString("Fail ") + pi + " x \"" + PATS[i] + "\" -> \"" +
1989 UnicodeString pattern("#,###");
1997 UnicodeString temp;
2019 UnicodeString f1;
2020 UnicodeString f2, temp;
2033 if (f1 != UnicodeString("-0.0")) {
2034 errln(UnicodeString("") + d1 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f1 + '"');
2036 if (f2 != UnicodeString("-0.0")) {
2037 errln(UnicodeString("") + d2 + UnicodeString(" x \"") + df->toPattern(temp) + "\" is formatted as \"" + f2 + '"');
2077 UnicodeString s;
2079 logln(UnicodeString("The number ") + dbl + " formatted to " + s);
2121 UnicodeString s;
2128 logln(UnicodeString("") +
2158 UnicodeString s;
2165 logln(UnicodeString("") + a + " -> \"" + s + "\" -> " +
2168 errln(UnicodeString("") + a + " -> \"" + s + "\" -> " +
2203 errln(UnicodeString("FAIL: parse(\"-0.0\") returns ") + toString(n));
2226 UnicodeString s;
2231 UnicodeString exp(DATA[i+1]);
2233 errln(UnicodeString("FAIL: ") + DATA[i] + " -> " +
2265 UnicodeString pat(DATA[i+1]);
2266 UnicodeString exp(DATA[i+2]);
2269 UnicodeString out;
2273 logln(UnicodeString("Ok: ") + in + " x " + pat + " = " + out);
2275 errln(UnicodeString("FAIL: ") + in + " x " + pat + " = " + out +
2294 DecimalFormat fmt(UnicodeString("#"), sym, status);
2299 UnicodeString s;
2306 errln(UnicodeString("FAIL: -1 x (minus=^) -> ") + s +
2310 if (fmt.getNegativePrefix(s) != UnicodeString((UChar)0x5e)) {
2311 errln(UnicodeString("FAIL: (minus=^).getNegativePrefix -> ") +
2316 fmt.applyPattern(UnicodeString("#%"), status);
2322 errln(UnicodeString("FAIL: 0.25 x (percent=^) -> ") + s +
2326 if (fmt.getPositiveSuffix(s) != UnicodeString((UChar)0x5e)) {
2327 errln(UnicodeString("FAIL: (percent=^).getPositiveSuffix -> ") +
2338 errln(UnicodeString("FAIL: 0.25 x (permill=^) -> ") + s +
2342 if (fmt.getPositiveSuffix(s) != UnicodeString((UChar)0x5e)) {
2343 errln(UnicodeString("FAIL: (permill=^).getPositiveSuffix -> ") +
2353 if (fmt.format(12.5, s, pos) != UnicodeString("usd12.50")) {
2354 errln(UnicodeString("FAIL: 12.5 x (currency=usd) -> ") + s +
2358 if (fmt.getPositivePrefix(s) != UnicodeString("usd")) {
2359 errln(UnicodeString("FAIL: (currency=usd).getPositivePrefix -> ") +
2369 if (fmt.format(12.5, s, pos) != UnicodeString("DOL12.50")) {
2370 errln(UnicodeString("FAIL: 12.5 x (intlcurrency=DOL) -> ") + s +
2374 if (fmt.getPositivePrefix(s) != UnicodeString("DOL")) {
2375 errln(UnicodeString("FAIL: (intlcurrency=DOL).getPositivePrefix -> ") +
2413 UnicodeString pat;
2419 UnicodeString("Construct DecimalFormat(") + pat + ")")) {
2423 UnicodeString l, p;
2424 errln(UnicodeString("FAIL: ") + type[j] + avail[i].getDisplayName(l) +
2428 UnicodeString l, p;
2429 logln(UnicodeString("PASS: ") + type[j] + avail[i].getDisplayName(l) +
2438 UnicodeString("applyLocalizedPattern(") + pat + ")", avail[i]);
2448 UnicodeString("setCurrency() for (") + pat + ")", avail[i]);
2454 UnicodeString l, p;
2455 errln(UnicodeString("FAIL: ") + type[j] + avail[i].getDisplayName(l) +
2482 UnicodeString str((UnicodeString)"" + DATA[i]);
2490 errln(UnicodeString("FAIL: Wanted number, got ") +
2496 errln(UnicodeString("\"") + str + "\" parse(x " +
2523 UnicodeString s;
2525 if (s != UnicodeString(S[i])) {
2526 errln(UnicodeString("FAIL: Got ") + s + ", exp " + S[i]);
2545 UnicodeString s;
2547 UnicodeString pat;
2548 logln(UnicodeString() + a + " x " +
2550 if (s != UnicodeString("-0.1")) {
2564 DecimalFormat fmt(UnicodeString("0."), sym, status);
2572 UnicodeString str;
2573 UnicodeString exp(STR[i]);
2577 logln(UnicodeString("Ok ") + NUM[i] + " x 0. = " + str);
2579 errln(UnicodeString("FAIL ") + NUM[i] + " x 0. = " + str +
2595 DecimalFormat fmt(UnicodeString("#.#"), sym, status);
2600 UnicodeString str;
2604 UnicodeString exp("0");
2606 logln(UnicodeString("Ok 0.0 x #.# = ") + str);
2608 errln(UnicodeString("FAIL 0.0 x #.# = ") + str +
2618 logln(UnicodeString("Ok 99.99 / #.# = ") + toString(val));
2620 errln(UnicodeString("FAIL 99.99 / #.# = ") + toString(val) +
2627 logln(UnicodeString("Ok 0.0 x #.# = ") + str);
2629 errln(UnicodeString("FAIL 0.0 x #.# = ") + str +
2644 UnicodeString udt("11.10.2000", "");
2645 UnicodeString exp("11.10.00", "");
2650 dataerrln("FAIL: Calendar::createInstance() returned " + (UnicodeString)u_errorName(status));
2657 dataerrln("FAIL: NumberFormat::createInstance() returned " + (UnicodeString)u_errorName(status));
2667 errln("FAIL: DateFormat::createInstance() returned " + (UnicodeString)u_errorName(status));
2679 UnicodeString outString;