1 /******************************************************************** 2 * COPYRIGHT: 3 * Copyright (c) 1997-2010, International Business Machines Corporation and 4 * others. All Rights Reserved. 5 ********************************************************************/ 6 /* Modification History: 7 * Date Name Description 8 * 07/15/99 helena Ported to HPUX 10/11 CC. 9 */ 10 11 #include "unicode/utypes.h" 12 13 #if !UCONFIG_NO_FORMATTING 14 15 #include "numfmtst.h" 16 #include "unicode/dcfmtsym.h" 17 #include "unicode/decimfmt.h" 18 #include "unicode/ucurr.h" 19 #include "unicode/ustring.h" 20 #include "unicode/measfmt.h" 21 #include "unicode/curramt.h" 22 #include "digitlst.h" 23 #include "textfile.h" 24 #include "tokiter.h" 25 #include "charstr.h" 26 #include "putilimp.h" 27 #include "winnmtst.h" 28 #include <float.h> 29 #include <string.h> 30 #include <stdlib.h> 31 #include "cstring.h" 32 #include "unicode/numsys.h" 33 34 //#define NUMFMTST_CACHE_DEBUG 1 35 #include "stdio.h" /* for sprintf */ 36 // #include "iostream" // for cout 37 38 //#define NUMFMTST_DEBUG 1 39 40 41 static const UChar EUR[] = {69,85,82,0}; // "EUR" 42 static const UChar ISO_CURRENCY_USD[] = {0x55, 0x53, 0x44, 0}; // "USD" 43 44 // ***************************************************************************** 45 // class NumberFormatTest 46 // ***************************************************************************** 47 48 #define CASE(id,test) case id: name = #test; if (exec) { logln(#test "---"); logln((UnicodeString)""); test(); } break 49 50 #define CHECK(status,str) if (U_FAILURE(status)) { errcheckln(status, UnicodeString("FAIL: ") + str + " - " + u_errorName(status)); return; } 51 52 void NumberFormatTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* /*par*/ ) 53 { 54 // if (exec) logln((UnicodeString)"TestSuite DateFormatTest"); 55 switch (index) { 56 CASE(0,TestCurrencySign); 57 CASE(1,TestCurrency); 58 CASE(2,TestParse); 59 CASE(3,TestRounding487); 60 CASE(4,TestQuotes); 61 CASE(5,TestExponential); 62 CASE(6,TestPatterns); 63 64 // Upgrade to alphaWorks - liu 5/99 65 CASE(7,TestExponent); 66 CASE(8,TestScientific); 67 CASE(9,TestPad); 68 CASE(10,TestPatterns2); 69 CASE(11,TestSecondaryGrouping); 70 CASE(12,TestSurrogateSupport); 71 CASE(13,TestAPI); 72 73 CASE(14,TestCurrencyObject); 74 CASE(15,TestCurrencyPatterns); 75 //CASE(16,TestDigitList); 76 CASE(16,TestWhiteSpaceParsing); 77 CASE(17,TestComplexCurrency); // This test removed because CLDR no longer uses choice formats in currency symbols. 78 CASE(18,TestRegCurrency); 79 CASE(19,TestSymbolsWithBadLocale); 80 CASE(20,TestAdoptDecimalFormatSymbols); 81 82 CASE(21,TestScientific2); 83 CASE(22,TestScientificGrouping); 84 CASE(23,TestInt64); 85 86 CASE(24,TestPerMill); 87 CASE(25,TestIllegalPatterns); 88 CASE(26,TestCases); 89 90 CASE(27,TestCurrencyNames); 91 CASE(28,TestCurrencyAmount); 92 CASE(29,TestCurrencyUnit); 93 CASE(30,TestCoverage); 94 CASE(31,TestJB3832); 95 CASE(32,TestHost); 96 CASE(33,TestHostClone); 97 CASE(34,TestCurrencyFormat); 98 CASE(35,TestRounding); 99 CASE(36,TestNonpositiveMultiplier); 100 CASE(37,TestNumberingSystems); 101 CASE(38,TestSpaceParsing); 102 CASE(39,TestMultiCurrencySign); 103 CASE(40,TestCurrencyFormatForMixParsing); 104 CASE(41,TestDecimalFormatCurrencyParse); 105 CASE(42,TestCurrencyIsoPluralFormat); 106 CASE(43,TestCurrencyParsing); 107 CASE(44,TestParseCurrencyInUCurr); 108 CASE(45,TestFormatAttributes); 109 CASE(46,TestFieldPositionIterator); 110 CASE(47,TestDecimal); 111 default: name = ""; break; 112 } 113 } 114 115 // ------------------------------------- 116 117 // Test API (increase code coverage) 118 void 119 NumberFormatTest::TestAPI(void) 120 { 121 logln("Test API"); 122 UErrorCode status = U_ZERO_ERROR; 123 NumberFormat *test = NumberFormat::createInstance("root", status); 124 if(U_FAILURE(status)) { 125 dataerrln("unable to create format object - %s", u_errorName(status)); 126 } 127 if(test != NULL) { 128 test->setMinimumIntegerDigits(10); 129 test->setMaximumIntegerDigits(2); 130 131 test->setMinimumFractionDigits(10); 132 test->setMaximumFractionDigits(2); 133 134 UnicodeString result; 135 FieldPosition pos; 136 Formattable bla("Paja Patak"); // Donald Duck for non Serbian speakers 137 test->format(bla, result, pos, status); 138 if(U_SUCCESS(status)) { 139 errln("Yuck... Formatted a duck... As a number!"); 140 } else { 141 status = U_ZERO_ERROR; 142 } 143 144 result.remove(); 145 int64_t ll = 12; 146 test->format(ll, result); 147 if (result != "12.00"){ 148 errln("format int64_t error"); 149 } 150 151 ParsePosition ppos; 152 test->parseCurrency("",bla,ppos); 153 if(U_FAILURE(status)) { 154 errln("Problems accessing the parseCurrency function for NumberFormat"); 155 } 156 157 delete test; 158 } 159 } 160 161 class StubNumberForamt :public NumberFormat{ 162 public: 163 StubNumberForamt(){}; 164 virtual UnicodeString& format(double ,UnicodeString& appendTo,FieldPosition& ) const { 165 return appendTo; 166 } 167 virtual UnicodeString& format(int32_t ,UnicodeString& appendTo,FieldPosition& ) const { 168 return appendTo.append((UChar)0x0033); 169 } 170 virtual UnicodeString& format(int64_t number,UnicodeString& appendTo,FieldPosition& pos) const { 171 return NumberFormat::format(number, appendTo, pos); 172 } 173 virtual UnicodeString& format(const Formattable& , UnicodeString& appendTo, FieldPosition& , UErrorCode& ) const { 174 return appendTo; 175 } 176 virtual void parse(const UnicodeString& , 177 Formattable& , 178 ParsePosition& ) const {} 179 virtual void parse( const UnicodeString& , 180 Formattable& , 181 UErrorCode& ) const {} 182 virtual UClassID getDynamicClassID(void) const { 183 static char classID = 0; 184 return (UClassID)&classID; 185 } 186 virtual Format* clone() const {return NULL;} 187 }; 188 189 void 190 NumberFormatTest::TestCoverage(void){ 191 StubNumberForamt stub; 192 UnicodeString agent("agent"); 193 FieldPosition pos; 194 int64_t num = 4; 195 if (stub.format(num, agent, pos) != UnicodeString("agent3")){ 196 errln("NumberFormat::format(int64, UnicodString&, FieldPosition&) should delegate to (int32, ,)"); 197 }; 198 } 199 200 // Test various patterns 201 void 202 NumberFormatTest::TestPatterns(void) 203 { 204 UErrorCode status = U_ZERO_ERROR; 205 DecimalFormatSymbols sym(Locale::getUS(), status); 206 if (U_FAILURE(status)) { errcheckln(status, "FAIL: Could not construct DecimalFormatSymbols - %s", u_errorName(status)); return; } 207 208 const char* pat[] = { "#.#", "#.", ".#", "#" }; 209 int32_t pat_length = (int32_t)(sizeof(pat) / sizeof(pat[0])); 210 const char* newpat[] = { "#0.#", "#0.", "#.0", "#" }; 211 const char* num[] = { "0", "0.", ".0", "0" }; 212 for (int32_t i=0; i<pat_length; ++i) 213 { 214 status = U_ZERO_ERROR; 215 DecimalFormat fmt(pat[i], sym, status); 216 if (U_FAILURE(status)) { errln((UnicodeString)"FAIL: DecimalFormat constructor failed for " + pat[i]); continue; } 217 UnicodeString newp; fmt.toPattern(newp); 218 if (!(newp == newpat[i])) 219 errln((UnicodeString)"FAIL: Pattern " + pat[i] + " should transmute to " + newpat[i] + 220 "; " + newp + " seen instead"); 221 222 UnicodeString s; (*(NumberFormat*)&fmt).format((int32_t)0, s); 223 if (!(s == num[i])) 224 { 225 errln((UnicodeString)"FAIL: Pattern " + pat[i] + " should format zero as " + num[i] + 226 "; " + s + " seen instead"); 227 logln((UnicodeString)"Min integer digits = " + fmt.getMinimumIntegerDigits()); 228 } 229 } 230 } 231 232 /* 233 icu_2_4::DigitList::operator== 0 0 2 icuuc24d.dll digitlst.cpp Doug 234 icu_2_4::DigitList::append 0 0 4 icuin24d.dll digitlst.h Doug 235 icu_2_4::DigitList::operator!= 0 0 1 icuuc24d.dll digitlst.h Doug 236 */ 237 /* 238 void 239 NumberFormatTest::TestDigitList(void) 240 { 241 // API coverage for DigitList 242 DigitList list1; 243 list1.append('1'); 244 list1.fDecimalAt = 1; 245 DigitList list2; 246 list2.set((int32_t)1); 247 if (list1 != list2) { 248 errln("digitlist append, operator!= or set failed "); 249 } 250 if (!(list1 == list2)) { 251 errln("digitlist append, operator== or set failed "); 252 } 253 } 254 */ 255 256 // ------------------------------------- 257 258 // Test exponential pattern 259 void 260 NumberFormatTest::TestExponential(void) 261 { 262 UErrorCode status = U_ZERO_ERROR; 263 DecimalFormatSymbols sym(Locale::getUS(), status); 264 if (U_FAILURE(status)) { errcheckln(status, "FAIL: Bad status returned by DecimalFormatSymbols ct - %s", u_errorName(status)); return; } 265 const char* pat[] = { "0.####E0", "00.000E00", "##0.######E000", "0.###E0;[0.###E0]" }; 266 int32_t pat_length = (int32_t)(sizeof(pat) / sizeof(pat[0])); 267 268 // The following #if statements allow this test to be built and run on 269 // platforms that do not have standard IEEE numerics. For example, 270 // S/390 doubles have an exponent range of -78 to +75. For the 271 // following #if statements to work, float.h must define 272 // DBL_MAX_10_EXP to be a compile-time constant. 273 274 // This section may be expanded as needed. 275 276 #if DBL_MAX_10_EXP > 300 277 double val[] = { 0.01234, 123456789, 1.23e300, -3.141592653e-271 }; 278 int32_t val_length = (int32_t)(sizeof(val) / sizeof(val[0])); 279 const char* valFormat[] = 280 { 281 // 0.####E0 282 "1.234E-2", "1.2346E8", "1.23E300", "-3.1416E-271", 283 // 00.000E00 284 "12.340E-03", "12.346E07", "12.300E299", "-31.416E-272", 285 // ##0.######E000 286 "12.34E-003", "123.4568E006", "1.23E300", "-314.1593E-273", 287 // 0.###E0;[0.###E0] 288 "1.234E-2", "1.235E8", "1.23E300", "[3.142E-271]" 289 }; 290 double valParse[] = 291 { 292 0.01234, 123460000, 1.23E300, -3.1416E-271, 293 0.01234, 123460000, 1.23E300, -3.1416E-271, 294 0.01234, 123456800, 1.23E300, -3.141593E-271, 295 0.01234, 123500000, 1.23E300, -3.142E-271, 296 }; 297 #elif DBL_MAX_10_EXP > 70 298 double val[] = { 0.01234, 123456789, 1.23e70, -3.141592653e-71 }; 299 int32_t val_length = sizeof(val) / sizeof(val[0]); 300 char* valFormat[] = 301 { 302 // 0.####E0 303 "1.234E-2", "1.2346E8", "1.23E70", "-3.1416E-71", 304 // 00.000E00 305 "12.340E-03", "12.346E07", "12.300E69", "-31.416E-72", 306 // ##0.######E000 307 "12.34E-003", "123.4568E006", "12.3E069", "-31.41593E-072", 308 // 0.###E0;[0.###E0] 309 "1.234E-2", "1.235E8", "1.23E70", "[3.142E-71]" 310 }; 311 double valParse[] = 312 { 313 0.01234, 123460000, 1.23E70, -3.1416E-71, 314 0.01234, 123460000, 1.23E70, -3.1416E-71, 315 0.01234, 123456800, 1.23E70, -3.141593E-71, 316 0.01234, 123500000, 1.23E70, -3.142E-71, 317 }; 318 #else 319 // Don't test double conversion 320 double* val = 0; 321 int32_t val_length = 0; 322 char** valFormat = 0; 323 double* valParse = 0; 324 logln("Warning: Skipping double conversion tests"); 325 #endif 326 327 int32_t lval[] = { 0, -1, 1, 123456789 }; 328 int32_t lval_length = (int32_t)(sizeof(lval) / sizeof(lval[0])); 329 const char* lvalFormat[] = 330 { 331 // 0.####E0 332 "0E0", "-1E0", "1E0", "1.2346E8", 333 // 00.000E00 334 "00.000E00", "-10.000E-01", "10.000E-01", "12.346E07", 335 // ##0.######E000 336 "0E000", "-1E000", "1E000", "123.4568E006", 337 // 0.###E0;[0.###E0] 338 "0E0", "[1E0]", "1E0", "1.235E8" 339 }; 340 int32_t lvalParse[] = 341 { 342 0, -1, 1, 123460000, 343 0, -1, 1, 123460000, 344 0, -1, 1, 123456800, 345 0, -1, 1, 123500000, 346 }; 347 int32_t ival = 0, ilval = 0; 348 for (int32_t p=0; p<pat_length; ++p) 349 { 350 DecimalFormat fmt(pat[p], sym, status); 351 if (U_FAILURE(status)) { errln("FAIL: Bad status returned by DecimalFormat ct"); continue; } 352 UnicodeString pattern; 353 logln((UnicodeString)"Pattern \"" + pat[p] + "\" -toPattern-> \"" + 354 fmt.toPattern(pattern) + "\""); 355 int32_t v; 356 for (v=0; v<val_length; ++v) 357 { 358 UnicodeString s; (*(NumberFormat*)&fmt).format(val[v], s); 359 logln((UnicodeString)" " + val[v] + " -format-> " + s); 360 if (s != valFormat[v+ival]) 361 errln((UnicodeString)"FAIL: Expected " + valFormat[v+ival]); 362 363 ParsePosition pos(0); 364 Formattable af; 365 fmt.parse(s, af, pos); 366 double a; 367 UBool useEpsilon = FALSE; 368 if (af.getType() == Formattable::kLong) 369 a = af.getLong(); 370 else if (af.getType() == Formattable::kDouble) { 371 a = af.getDouble(); 372 #if defined(OS390) || defined(OS400) 373 // S/390 will show a failure like this: 374 //| -3.141592652999999e-271 -format-> -3.1416E-271 375 //| -parse-> -3.1416e-271 376 //| FAIL: Expected -3.141599999999999e-271 377 // To compensate, we use an epsilon-based equality 378 // test on S/390 only. We don't want to do this in 379 // general because it's less exacting. 380 useEpsilon = TRUE; 381 #endif 382 } 383 else { 384 errln((UnicodeString)"FAIL: Non-numeric Formattable returned"); 385 continue; 386 } 387 if (pos.getIndex() == s.length()) 388 { 389 logln((UnicodeString)" -parse-> " + a); 390 // Use epsilon comparison as necessary 391 if ((useEpsilon && 392 (uprv_fabs(a - valParse[v+ival]) / a > (2*DBL_EPSILON))) || 393 (!useEpsilon && a != valParse[v+ival])) 394 { 395 errln((UnicodeString)"FAIL: Expected " + valParse[v+ival]); 396 } 397 } 398 else { 399 errln((UnicodeString)"FAIL: Partial parse (" + pos.getIndex() + " chars) -> " + a); 400 errln((UnicodeString)" should be (" + s.length() + " chars) -> " + valParse[v+ival]); 401 } 402 } 403 for (v=0; v<lval_length; ++v) 404 { 405 UnicodeString s; 406 (*(NumberFormat*)&fmt).format(lval[v], s); 407 logln((UnicodeString)" " + lval[v] + "L -format-> " + s); 408 if (s != lvalFormat[v+ilval]) 409 errln((UnicodeString)"ERROR: Expected " + lvalFormat[v+ilval] + " Got: " + s); 410 411 ParsePosition pos(0); 412 Formattable af; 413 fmt.parse(s, af, pos); 414 if (af.getType() == Formattable::kLong || 415 af.getType() == Formattable::kInt64) { 416 UErrorCode status = U_ZERO_ERROR; 417 int32_t a = af.getLong(status); 418 if (pos.getIndex() == s.length()) 419 { 420 logln((UnicodeString)" -parse-> " + a); 421 if (a != lvalParse[v+ilval]) 422 errln((UnicodeString)"FAIL: Expected " + lvalParse[v+ilval]); 423 } 424 else 425 errln((UnicodeString)"FAIL: Partial parse (" + pos.getIndex() + " chars) -> " + a); 426 } 427 else 428 errln((UnicodeString)"FAIL: Non-long Formattable returned for " + s 429 + " Double: " + af.getDouble() 430 + ", Long: " + af.getLong()); 431 } 432 ival += val_length; 433 ilval += lval_length; 434 } 435 } 436 437 void 438 NumberFormatTest::TestScientific2() { 439 // jb 2552 440 UErrorCode status = U_ZERO_ERROR; 441 DecimalFormat* fmt = (DecimalFormat*)NumberFormat::createCurrencyInstance("en_US", status); 442 if (U_SUCCESS(status)) { 443 double num = 12.34; 444 expect(*fmt, num, "$12.34"); 445 fmt->setScientificNotation(TRUE); 446 expect(*fmt, num, "$1.23E1"); 447 fmt->setScientificNotation(FALSE); 448 expect(*fmt, num, "$12.34"); 449 } 450 delete fmt; 451 } 452 453 void 454 NumberFormatTest::TestScientificGrouping() { 455 // jb 2552 456 UErrorCode status = U_ZERO_ERROR; 457 DecimalFormat fmt("##0.00E0",status); 458 if (U_SUCCESS(status)) { 459 expect(fmt, .01234, "12.3E-3"); 460 expect(fmt, .1234, "123E-3"); 461 expect(fmt, 1.234, "1.23E0"); 462 expect(fmt, 12.34, "12.3E0"); 463 expect(fmt, 123.4, "123E0"); 464 expect(fmt, 1234., "1.23E3"); 465 } 466 } 467 468 /*static void setFromString(DigitList& dl, const char* str) { 469 char c; 470 UBool decimalSet = FALSE; 471 dl.clear(); 472 while ((c = *str++)) { 473 if (c == '-') { 474 dl.fIsPositive = FALSE; 475 } else if (c == '+') { 476 dl.fIsPositive = TRUE; 477 } else if (c == '.') { 478 dl.fDecimalAt = dl.fCount; 479 decimalSet = TRUE; 480 } else { 481 dl.append(c); 482 } 483 } 484 if (!decimalSet) { 485 dl.fDecimalAt = dl.fCount; 486 } 487 }*/ 488 489 void 490 NumberFormatTest::TestInt64() { 491 UErrorCode status = U_ZERO_ERROR; 492 DecimalFormat fmt("#.#E0",status); 493 fmt.setMaximumFractionDigits(20); 494 if (U_SUCCESS(status)) { 495 expect(fmt, (Formattable)(int64_t)0, "0E0"); 496 expect(fmt, (Formattable)(int64_t)-1, "-1E0"); 497 expect(fmt, (Formattable)(int64_t)1, "1E0"); 498 expect(fmt, (Formattable)(int64_t)2147483647, "2.147483647E9"); 499 expect(fmt, (Formattable)((int64_t)-2147483647-1), "-2.147483648E9"); 500 expect(fmt, (Formattable)(int64_t)U_INT64_MAX, "9.223372036854775807E18"); 501 expect(fmt, (Formattable)(int64_t)U_INT64_MIN, "-9.223372036854775808E18"); 502 } 503 504 // also test digitlist 505 /* int64_t int64max = U_INT64_MAX; 506 int64_t int64min = U_INT64_MIN; 507 const char* int64maxstr = "9223372036854775807"; 508 const char* int64minstr = "-9223372036854775808"; 509 UnicodeString fail("fail: "); 510 511 // test max int64 value 512 DigitList dl; 513 setFromString(dl, int64maxstr); 514 { 515 if (!dl.fitsIntoInt64(FALSE)) { 516 errln(fail + int64maxstr + " didn't fit"); 517 } 518 int64_t int64Value = dl.getInt64(); 519 if (int64Value != int64max) { 520 errln(fail + int64maxstr); 521 } 522 dl.set(int64Value); 523 int64Value = dl.getInt64(); 524 if (int64Value != int64max) { 525 errln(fail + int64maxstr); 526 } 527 } 528 // test negative of max int64 value (1 shy of min int64 value) 529 dl.fIsPositive = FALSE; 530 { 531 if (!dl.fitsIntoInt64(FALSE)) { 532 errln(fail + "-" + int64maxstr + " didn't fit"); 533 } 534 int64_t int64Value = dl.getInt64(); 535 if (int64Value != -int64max) { 536 errln(fail + "-" + int64maxstr); 537 } 538 dl.set(int64Value); 539 int64Value = dl.getInt64(); 540 if (int64Value != -int64max) { 541 errln(fail + "-" + int64maxstr); 542 } 543 } 544 // test min int64 value 545 setFromString(dl, int64minstr); 546 { 547 if (!dl.fitsIntoInt64(FALSE)) { 548 errln(fail + "-" + int64minstr + " didn't fit"); 549 } 550 int64_t int64Value = dl.getInt64(); 551 if (int64Value != int64min) { 552 errln(fail + int64minstr); 553 } 554 dl.set(int64Value); 555 int64Value = dl.getInt64(); 556 if (int64Value != int64min) { 557 errln(fail + int64minstr); 558 } 559 } 560 // test negative of min int 64 value (1 more than max int64 value) 561 dl.fIsPositive = TRUE; // won't fit 562 { 563 if (dl.fitsIntoInt64(FALSE)) { 564 errln(fail + "-(" + int64minstr + ") didn't fit"); 565 } 566 }*/ 567 } 568 569 // ------------------------------------- 570 571 // Test the handling of quotes 572 void 573 NumberFormatTest::TestQuotes(void) 574 { 575 UErrorCode status = U_ZERO_ERROR; 576 UnicodeString *pat; 577 DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::getUS(), status); 578 if (U_FAILURE(status)) { 579 errcheckln(status, "Fail to create DecimalFormatSymbols - %s", u_errorName(status)); 580 delete sym; 581 return; 582 } 583 pat = new UnicodeString("a'fo''o'b#"); 584 DecimalFormat *fmt = new DecimalFormat(*pat, *sym, status); 585 UnicodeString s; 586 ((NumberFormat*)fmt)->format((int32_t)123, s); 587 logln((UnicodeString)"Pattern \"" + *pat + "\""); 588 logln((UnicodeString)" Format 123 -> " + escape(s)); 589 if (!(s=="afo'ob123")) 590 errln((UnicodeString)"FAIL: Expected afo'ob123"); 591 592 s.truncate(0); 593 delete fmt; 594 delete pat; 595 596 pat = new UnicodeString("a''b#"); 597 fmt = new DecimalFormat(*pat, *sym, status); 598 ((NumberFormat*)fmt)->format((int32_t)123, s); 599 logln((UnicodeString)"Pattern \"" + *pat + "\""); 600 logln((UnicodeString)" Format 123 -> " + escape(s)); 601 if (!(s=="a'b123")) 602 errln((UnicodeString)"FAIL: Expected a'b123"); 603 delete fmt; 604 delete pat; 605 delete sym; 606 } 607 608 /** 609 * Test the handling of the currency symbol in patterns. 610 */ 611 void 612 NumberFormatTest::TestCurrencySign(void) 613 { 614 UErrorCode status = U_ZERO_ERROR; 615 DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale::getUS(), status); 616 UnicodeString pat; 617 UChar currency = 0x00A4; 618 if (U_FAILURE(status)) { 619 errcheckln(status, "Fail to create DecimalFormatSymbols - %s", u_errorName(status)); 620 delete sym; 621 return; 622 } 623 // "\xA4#,##0.00;-\xA4#,##0.00" 624 pat.append(currency).append("#,##0.00;-"). 625 append(currency).append("#,##0.00"); 626 DecimalFormat *fmt = new DecimalFormat(pat, *sym, status); 627 UnicodeString s; ((NumberFormat*)fmt)->format(1234.56, s); 628 pat.truncate(0); 629 logln((UnicodeString)"Pattern \"" + fmt->toPattern(pat) + "\""); 630 logln((UnicodeString)" Format " + 1234.56 + " -> " + escape(s)); 631 if (s != "$1,234.56") errln((UnicodeString)"FAIL: Expected $1,234.56"); 632 s.truncate(0); 633 ((NumberFormat*)fmt)->format(- 1234.56, s); 634 logln((UnicodeString)" Format " + (-1234.56) + " -> " + escape(s)); 635 if (s != "-$1,234.56") errln((UnicodeString)"FAIL: Expected -$1,234.56"); 636 delete fmt; 637 pat.truncate(0); 638 // "\xA4\xA4 #,##0.00;\xA4\xA4 -#,##0.00" 639 pat.append(currency).append(currency). 640 append(" #,##0.00;"). 641 append(currency).append(currency). 642 append(" -#,##0.00"); 643 fmt = new DecimalFormat(pat, *sym, status); 644 s.truncate(0); 645 ((NumberFormat*)fmt)->format(1234.56, s); 646 logln((UnicodeString)"Pattern \"" + fmt->toPattern(pat) + "\""); 647 logln((UnicodeString)" Format " + 1234.56 + " -> " + escape(s)); 648 if (s != "USD 1,234.56") errln((UnicodeString)"FAIL: Expected USD 1,234.56"); 649 s.truncate(0); 650 ((NumberFormat*)fmt)->format(-1234.56, s); 651 logln((UnicodeString)" Format " + (-1234.56) + " -> " + escape(s)); 652 if (s != "USD -1,234.56") errln((UnicodeString)"FAIL: Expected USD -1,234.56"); 653 delete fmt; 654 delete sym; 655 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + u_errorName(status)); 656 } 657 658 // ------------------------------------- 659 660 static UChar toHexString(int32_t i) { return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); } 661 662 UnicodeString& 663 NumberFormatTest::escape(UnicodeString& s) 664 { 665 UnicodeString buf; 666 for (int32_t i=0; i<s.length(); ++i) 667 { 668 UChar c = s[(int32_t)i]; 669 if (c <= (UChar)0x7F) buf += c; 670 else { 671 buf += (UChar)0x5c; buf += (UChar)0x55; 672 buf += toHexString((c & 0xF000) >> 12); 673 buf += toHexString((c & 0x0F00) >> 8); 674 buf += toHexString((c & 0x00F0) >> 4); 675 buf += toHexString(c & 0x000F); 676 } 677 } 678 return (s = buf); 679 } 680 681 682 // ------------------------------------- 683 static const char* testCases[][2]= { 684 /* locale ID */ /* expected */ 685 {"ca_ES_PREEURO", "1.150\\u00A0\\u20A7" }, 686 {"de_LU_PREEURO", "1,150\\u00A0F" }, 687 {"el_GR_PREEURO", "1.150,50\\u00A0\\u0394\\u03C1\\u03C7" }, 688 {"en_BE_PREEURO", "1.150,50\\u00A0BF" }, 689 {"es_ES_PREEURO", "\\u20A7\\u00A01.150" }, 690 {"eu_ES_PREEURO", "1.150\\u00A0\\u20A7" }, 691 {"gl_ES_PREEURO", "1.150\\u00A0\\u20A7" }, 692 {"it_IT_PREEURO", "IT\\u20A4\\u00A01.150" }, 693 {"pt_PT_PREEURO", "1,150$50\\u00A0Esc."}, 694 {"en_US@currency=JPY", "\\u00A51,150"} 695 }; 696 /** 697 * Test localized currency patterns. 698 */ 699 void 700 NumberFormatTest::TestCurrency(void) 701 { 702 UErrorCode status = U_ZERO_ERROR; 703 NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(Locale::getCanadaFrench(), status); 704 if (U_FAILURE(status)) { 705 dataerrln("Error calling NumberFormat::createCurrencyInstance()"); 706 return; 707 } 708 709 UnicodeString s; currencyFmt->format(1.50, s); 710 logln((UnicodeString)"Un pauvre ici a..........." + s); 711 if (!(s==CharsToUnicodeString("1,50\\u00A0$"))) 712 errln((UnicodeString)"FAIL: Expected 1,50<nbsp>$"); 713 delete currencyFmt; 714 s.truncate(0); 715 char loc[256]={0}; 716 int len = uloc_canonicalize("de_DE_PREEURO", loc, 256, &status); 717 currencyFmt = NumberFormat::createCurrencyInstance(Locale(loc),status); 718 currencyFmt->format(1.50, s); 719 logln((UnicodeString)"Un pauvre en Allemagne a.." + s); 720 if (!(s==CharsToUnicodeString("1,50\\u00A0DM"))) 721 errln((UnicodeString)"FAIL: Expected 1,50<nbsp>DM"); 722 delete currencyFmt; 723 s.truncate(0); 724 len = uloc_canonicalize("fr_FR_PREEURO", loc, 256, &status); 725 currencyFmt = NumberFormat::createCurrencyInstance(Locale(loc), status); 726 currencyFmt->format(1.50, s); 727 logln((UnicodeString)"Un pauvre en France a....." + s); 728 if (!(s==CharsToUnicodeString("1,50\\u00A0F"))) 729 errln((UnicodeString)"FAIL: Expected 1,50<nbsp>F"); 730 delete currencyFmt; 731 if (U_FAILURE(status)) 732 errln((UnicodeString)"FAIL: Status " + (int32_t)status); 733 734 for(int i=0; i < (int)(sizeof(testCases)/sizeof(testCases[i])); i++){ 735 status = U_ZERO_ERROR; 736 const char *localeID = testCases[i][0]; 737 UnicodeString expected(testCases[i][1], -1, US_INV); 738 expected = expected.unescape(); 739 s.truncate(0); 740 char loc[256]={0}; 741 uloc_canonicalize(localeID, loc, 256, &status); 742 currencyFmt = NumberFormat::createCurrencyInstance(Locale(loc), status); 743 if(U_FAILURE(status)){ 744 errln("Could not create currency formatter for locale %s",localeID); 745 continue; 746 } 747 currencyFmt->format(1150.50, s); 748 if(s!=expected){ 749 errln(UnicodeString("FAIL: Expected: ")+expected 750 + UnicodeString(" Got: ") + s 751 + UnicodeString( " for locale: ")+ UnicodeString(localeID) ); 752 } 753 if (U_FAILURE(status)){ 754 errln((UnicodeString)"FAIL: Status " + (int32_t)status); 755 } 756 delete currencyFmt; 757 } 758 } 759 760 // ------------------------------------- 761 762 /** 763 * Test the Currency object handling, new as of ICU 2.2. 764 */ 765 void NumberFormatTest::TestCurrencyObject() { 766 UErrorCode ec = U_ZERO_ERROR; 767 NumberFormat* fmt = 768 NumberFormat::createCurrencyInstance(Locale::getUS(), ec); 769 770 if (U_FAILURE(ec)) { 771 dataerrln("FAIL: getCurrencyInstance(US) - %s", u_errorName(ec)); 772 delete fmt; 773 return; 774 } 775 776 Locale null("", "", ""); 777 778 expectCurrency(*fmt, null, 1234.56, "$1,234.56"); 779 780 expectCurrency(*fmt, Locale::getFrance(), 781 1234.56, CharsToUnicodeString("\\u20AC1,234.56")); // Euro 782 783 expectCurrency(*fmt, Locale::getJapan(), 784 1234.56, CharsToUnicodeString("\\u00A51,235")); // Yen 785 786 expectCurrency(*fmt, Locale("fr", "CH", ""), 787 1234.56, "CHF1,234.55"); // 0.05 rounding 788 789 expectCurrency(*fmt, Locale::getUS(), 790 1234.56, "$1,234.56"); 791 792 delete fmt; 793 fmt = NumberFormat::createCurrencyInstance(Locale::getFrance(), ec); 794 795 if (U_FAILURE(ec)) { 796 errln("FAIL: getCurrencyInstance(FRANCE)"); 797 delete fmt; 798 return; 799 } 800 801 expectCurrency(*fmt, null, 1234.56, CharsToUnicodeString("1 234,56 \\u20AC")); 802 803 expectCurrency(*fmt, Locale::getJapan(), 804 1234.56, CharsToUnicodeString("1 235 \\u00A5JP")); // Yen 805 806 expectCurrency(*fmt, Locale("fr", "CH", ""), 807 1234.56, "1 234,55 CHF"); // 0.05 rounding 808 809 expectCurrency(*fmt, Locale::getUS(), 810 1234.56, "1 234,56 $US"); 811 812 expectCurrency(*fmt, Locale::getFrance(), 813 1234.56, CharsToUnicodeString("1 234,56 \\u20AC")); // Euro 814 815 delete fmt; 816 } 817 818 // ------------------------------------- 819 820 /** 821 * Do rudimentary testing of parsing. 822 */ 823 void 824 NumberFormatTest::TestParse(void) 825 { 826 UErrorCode status = U_ZERO_ERROR; 827 UnicodeString arg("0"); 828 DecimalFormat* format = new DecimalFormat("00", status); 829 //try { 830 Formattable n; format->parse(arg, n, status); 831 logln((UnicodeString)"parse(" + arg + ") = " + n.getLong()); 832 if (n.getType() != Formattable::kLong || 833 n.getLong() != 0) errln((UnicodeString)"FAIL: Expected 0"); 834 delete format; 835 if (U_FAILURE(status)) errcheckln(status, (UnicodeString)"FAIL: Status " + u_errorName(status)); 836 //} 837 //catch(Exception e) { 838 // errln((UnicodeString)"Exception caught: " + e); 839 //} 840 } 841 842 // ------------------------------------- 843 844 /** 845 * Test proper rounding by the format method. 846 */ 847 void 848 NumberFormatTest::TestRounding487(void) 849 { 850 UErrorCode status = U_ZERO_ERROR; 851 NumberFormat *nf = NumberFormat::createInstance(status); 852 if (U_FAILURE(status)) { 853 dataerrln("Error calling NumberFormat::createInstance()"); 854 return; 855 } 856 857 roundingTest(*nf, 0.00159999, 4, "0.0016"); 858 roundingTest(*nf, 0.00995, 4, "0.01"); 859 860 roundingTest(*nf, 12.3995, 3, "12.4"); 861 862 roundingTest(*nf, 12.4999, 0, "12"); 863 roundingTest(*nf, - 19.5, 0, "-20"); 864 delete nf; 865 if (U_FAILURE(status)) errln((UnicodeString)"FAIL: Status " + (int32_t)status); 866 } 867 868 /** 869 * Test the functioning of the secondary grouping value. 870 */ 871 void NumberFormatTest::TestSecondaryGrouping(void) { 872 UErrorCode status = U_ZERO_ERROR; 873 DecimalFormatSymbols US(Locale::getUS(), status); 874 CHECK(status, "DecimalFormatSymbols ct"); 875 876 DecimalFormat f("#,##,###", US, status); 877 CHECK(status, "DecimalFormat ct"); 878 879 expect2(f, (int32_t)123456789L, "12,34,56,789"); 880 expectPat(f, "#,##,###"); 881 f.applyPattern("#,###", status); 882 CHECK(status, "applyPattern"); 883 884 f.setSecondaryGroupingSize(4); 885 expect2(f, (int32_t)123456789L, "12,3456,789"); 886 expectPat(f, "#,####,###"); 887 NumberFormat *g = NumberFormat::createInstance(Locale("hi", "IN"), status); 888 CHECK(status, "createInstance(hi_IN)"); 889 890 UnicodeString out; 891 int32_t l = (int32_t)1876543210L; 892 g->format(l, out); 893 delete g; 894 // expect "1,87,65,43,210", but with Hindi digits 895 // 01234567890123 896 UBool ok = TRUE; 897 if (out.length() != 14) { 898 ok = FALSE; 899 } else { 900 for (int32_t i=0; i<out.length(); ++i) { 901 UBool expectGroup = FALSE; 902 switch (i) { 903 case 1: 904 case 4: 905 case 7: 906 case 10: 907 expectGroup = TRUE; 908 break; 909 } 910 // Later -- fix this to get the actual grouping 911 // character from the resource bundle. 912 UBool isGroup = (out.charAt(i) == 0x002C); 913 if (isGroup != expectGroup) { 914 ok = FALSE; 915 break; 916 } 917 } 918 } 919 if (!ok) { 920 errln((UnicodeString)"FAIL Expected " + l + 921 " x hi_IN -> \"1,87,65,43,210\" (with Hindi digits), got \"" + 922 escape(out) + "\""); 923 } else { 924 logln((UnicodeString)"Ok " + l + 925 " x hi_IN -> \"" + 926 escape(out) + "\""); 927 } 928 } 929 930 void NumberFormatTest::TestWhiteSpaceParsing(void) { 931 UErrorCode ec = U_ZERO_ERROR; 932 DecimalFormatSymbols US(Locale::getUS(), ec); 933 DecimalFormat fmt("a b#0c ", US, ec); 934 if (U_FAILURE(ec)) { 935 errcheckln(ec, "FAIL: Constructor - %s", u_errorName(ec)); 936 return; 937 } 938 int32_t n = 1234; 939 expect(fmt, "a b1234c ", n); 940 expect(fmt, "a b1234c ", n); 941 } 942 943 /** 944 * Test currencies whose display name is a ChoiceFormat. 945 */ 946 void NumberFormatTest::TestComplexCurrency() { 947 948 // UErrorCode ec = U_ZERO_ERROR; 949 // Locale loc("kn", "IN", ""); 950 // NumberFormat* fmt = NumberFormat::createCurrencyInstance(loc, ec); 951 // if (U_SUCCESS(ec)) { 952 // expect2(*fmt, 1.0, CharsToUnicodeString("Re.\\u00A01.00")); 953 // Use .00392625 because that's 2^-8. Any value less than 0.005 is fine. 954 // expect(*fmt, 1.00390625, CharsToUnicodeString("Re.\\u00A01.00")); // tricky 955 // expect2(*fmt, 12345678.0, CharsToUnicodeString("Rs.\\u00A01,23,45,678.00")); 956 // expect2(*fmt, 0.5, CharsToUnicodeString("Rs.\\u00A00.50")); 957 // expect2(*fmt, -1.0, CharsToUnicodeString("-Re.\\u00A01.00")); 958 // expect2(*fmt, -10.0, CharsToUnicodeString("-Rs.\\u00A010.00")); 959 // } else { 960 // errln("FAIL: getCurrencyInstance(kn_IN)"); 961 // } 962 // delete fmt; 963 964 } 965 966 // ------------------------------------- 967 968 void 969 NumberFormatTest::roundingTest(NumberFormat& nf, double x, int32_t maxFractionDigits, const char* expected) 970 { 971 nf.setMaximumFractionDigits(maxFractionDigits); 972 UnicodeString out; nf.format(x, out); 973 logln((UnicodeString)"" + x + " formats with " + maxFractionDigits + " fractional digits to " + out); 974 if (!(out==expected)) errln((UnicodeString)"FAIL: Expected " + expected); 975 } 976 977 /** 978 * Upgrade to alphaWorks 979 */ 980 void NumberFormatTest::TestExponent(void) { 981 UErrorCode status = U_ZERO_ERROR; 982 DecimalFormatSymbols US(Locale::getUS(), status); 983 CHECK(status, "DecimalFormatSymbols constructor"); 984 DecimalFormat fmt1(UnicodeString("0.###E0"), US, status); 985 CHECK(status, "DecimalFormat(0.###E0)"); 986 DecimalFormat fmt2(UnicodeString("0.###E+0"), US, status); 987 CHECK(status, "DecimalFormat(0.###E+0)"); 988 int32_t n = 1234; 989 expect2(fmt1, n, "1.234E3"); 990 expect2(fmt2, n, "1.234E+3"); 991 expect(fmt1, "1.234E+3", n); // Either format should parse "E+3" 992 } 993 994 /** 995 * Upgrade to alphaWorks 996 */ 997 void NumberFormatTest::TestScientific(void) { 998 UErrorCode status = U_ZERO_ERROR; 999 DecimalFormatSymbols US(Locale::getUS(), status); 1000 CHECK(status, "DecimalFormatSymbols constructor"); 1001 1002 // Test pattern round-trip 1003 const char* PAT[] = { "#E0", "0.####E0", "00.000E00", "##0.####E000", 1004 "0.###E0;[0.###E0]" }; 1005 int32_t PAT_length = (int32_t)(sizeof(PAT) / sizeof(PAT[0])); 1006 int32_t DIGITS[] = { 1007 // min int, max int, min frac, max frac 1008 0, 1, 0, 0, // "#E0" 1009 1, 1, 0, 4, // "0.####E0" 1010 2, 2, 3, 3, // "00.000E00" 1011 1, 3, 0, 4, // "##0.####E000" 1012 1, 1, 0, 3, // "0.###E0;[0.###E0]" 1013 }; 1014 for (int32_t i=0; i<PAT_length; ++i) { 1015 UnicodeString pat(PAT[i]); 1016 DecimalFormat df(pat, US, status); 1017 CHECK(status, "DecimalFormat constructor"); 1018 UnicodeString pat2; 1019 df.toPattern(pat2); 1020 if (pat == pat2) { 1021 logln(UnicodeString("Ok Pattern rt \"") + 1022 pat + "\" -> \"" + 1023 pat2 + "\""); 1024 } else { 1025 errln(UnicodeString("FAIL Pattern rt \"") + 1026 pat + "\" -> \"" + 1027 pat2 + "\""); 1028 } 1029 // Make sure digit counts match what we expect 1030 if (df.getMinimumIntegerDigits() != DIGITS[4*i] || 1031 df.getMaximumIntegerDigits() != DIGITS[4*i+1] || 1032 df.getMinimumFractionDigits() != DIGITS[4*i+2] || 1033 df.getMaximumFractionDigits() != DIGITS[4*i+3]) { 1034 errln(UnicodeString("FAIL \"" + pat + 1035 "\" min/max int; min/max frac = ") + 1036 df.getMinimumIntegerDigits() + "/" + 1037 df.getMaximumIntegerDigits() + ";" + 1038 df.getMinimumFractionDigits() + "/" + 1039 df.getMaximumFractionDigits() + ", expect " + 1040 DIGITS[4*i] + "/" + 1041 DIGITS[4*i+1] + ";" + 1042 DIGITS[4*i+2] + "/" + 1043 DIGITS[4*i+3]); 1044 } 1045 } 1046 1047 1048 // Test the constructor for default locale. We have to 1049 // manually set the default locale, as there is no 1050 // guarantee that the default locale has the same 1051 // scientific format. 1052 Locale def = Locale::getDefault(); 1053 Locale::setDefault(Locale::getUS(), status); 1054 expect2(NumberFormat::createScientificInstance(status), 1055 12345.678901, 1056 "1.2345678901E4", status); 1057 Locale::setDefault(def, status); 1058 1059 expect2(new DecimalFormat("#E0", US, status), 1060 12345.0, 1061 "1.2345E4", status); 1062 expect(new DecimalFormat("0E0", US, status), 1063 12345.0, 1064 "1E4", status); 1065 expect2(NumberFormat::createScientificInstance(Locale::getUS(), status), 1066 12345.678901, 1067 "1.2345678901E4", status); 1068 expect(new DecimalFormat("##0.###E0", US, status), 1069 12345.0, 1070 "12.34E3", status); 1071 expect(new DecimalFormat("##0.###E0", US, status), 1072 12345.00001, 1073 "12.35E3", status); 1074 expect2(new DecimalFormat("##0.####E0", US, status), 1075 (int32_t) 12345, 1076 "12.345E3", status); 1077 expect2(NumberFormat::createScientificInstance(Locale::getFrance(), status), 1078 12345.678901, 1079 "1,2345678901E4", status); 1080 expect(new DecimalFormat("##0.####E0", US, status), 1081 789.12345e-9, 1082 "789.12E-9", status); 1083 expect2(new DecimalFormat("##0.####E0", US, status), 1084 780.e-9, 1085 "780E-9", status); 1086 expect(new DecimalFormat(".###E0", US, status), 1087 45678.0, 1088 ".457E5", status); 1089 expect2(new DecimalFormat(".###E0", US, status), 1090 (int32_t) 0, 1091 ".0E0", status); 1092 /* 1093 expect(new DecimalFormat[] { new DecimalFormat("#E0", US), 1094 new DecimalFormat("##E0", US), 1095 new DecimalFormat("####E0", US), 1096 new DecimalFormat("0E0", US), 1097 new DecimalFormat("00E0", US), 1098 new DecimalFormat("000E0", US), 1099 }, 1100 new Long(45678000), 1101 new String[] { "4.5678E7", 1102 "45.678E6", 1103 "4567.8E4", 1104 "5E7", 1105 "46E6", 1106 "457E5", 1107 } 1108 ); 1109 ! 1110 ! Unroll this test into individual tests below... 1111 ! 1112 */ 1113 expect2(new DecimalFormat("#E0", US, status), 1114 (int32_t) 45678000, "4.5678E7", status); 1115 expect2(new DecimalFormat("##E0", US, status), 1116 (int32_t) 45678000, "45.678E6", status); 1117 expect2(new DecimalFormat("####E0", US, status), 1118 (int32_t) 45678000, "4567.8E4", status); 1119 expect(new DecimalFormat("0E0", US, status), 1120 (int32_t) 45678000, "5E7", status); 1121 expect(new DecimalFormat("00E0", US, status), 1122 (int32_t) 45678000, "46E6", status); 1123 expect(new DecimalFormat("000E0", US, status), 1124 (int32_t) 45678000, "457E5", status); 1125 /* 1126 expect(new DecimalFormat("###E0", US, status), 1127 new Object[] { new Double(0.0000123), "12.3E-6", 1128 new Double(0.000123), "123E-6", 1129 new Double(0.00123), "1.23E-3", 1130 new Double(0.0123), "12.3E-3", 1131 new Double(0.123), "123E-3", 1132 new Double(1.23), "1.23E0", 1133 new Double(12.3), "12.3E0", 1134 new Double(123), "123E0", 1135 new Double(1230), "1.23E3", 1136 }); 1137 ! 1138 ! Unroll this test into individual tests below... 1139 ! 1140 */ 1141 expect2(new DecimalFormat("###E0", US, status), 1142 0.0000123, "12.3E-6", status); 1143 expect2(new DecimalFormat("###E0", US, status), 1144 0.000123, "123E-6", status); 1145 expect2(new DecimalFormat("###E0", US, status), 1146 0.00123, "1.23E-3", status); 1147 expect2(new DecimalFormat("###E0", US, status), 1148 0.0123, "12.3E-3", status); 1149 expect2(new DecimalFormat("###E0", US, status), 1150 0.123, "123E-3", status); 1151 expect2(new DecimalFormat("###E0", US, status), 1152 1.23, "1.23E0", status); 1153 expect2(new DecimalFormat("###E0", US, status), 1154 12.3, "12.3E0", status); 1155 expect2(new DecimalFormat("###E0", US, status), 1156 123.0, "123E0", status); 1157 expect2(new DecimalFormat("###E0", US, status), 1158 1230.0, "1.23E3", status); 1159 /* 1160 expect(new DecimalFormat("0.#E+00", US, status), 1161 new Object[] { new Double(0.00012), "1.2E-04", 1162 new Long(12000), "1.2E+04", 1163 }); 1164 ! 1165 ! Unroll this test into individual tests below... 1166 ! 1167 */ 1168 expect2(new DecimalFormat("0.#E+00", US, status), 1169 0.00012, "1.2E-04", status); 1170 expect2(new DecimalFormat("0.#E+00", US, status), 1171 (int32_t) 12000, "1.2E+04", status); 1172 } 1173 1174 /** 1175 * Upgrade to alphaWorks 1176 */ 1177 void NumberFormatTest::TestPad(void) { 1178 UErrorCode status = U_ZERO_ERROR; 1179 DecimalFormatSymbols US(Locale::getUS(), status); 1180 CHECK(status, "DecimalFormatSymbols constructor"); 1181 1182 expect2(new DecimalFormat("*^##.##", US, status), 1183 int32_t(0), "^^^^0", status); 1184 expect2(new DecimalFormat("*^##.##", US, status), 1185 -1.3, "^-1.3", status); 1186 expect2(new DecimalFormat("##0.0####E0*_ 'g-m/s^2'", US, status), 1187 int32_t(0), "0.0E0______ g-m/s^2", status); 1188 expect(new DecimalFormat("##0.0####E0*_ 'g-m/s^2'", US, status), 1189 1.0/3, "333.333E-3_ g-m/s^2", status); 1190 expect2(new DecimalFormat("##0.0####*_ 'g-m/s^2'", US, status), 1191 int32_t(0), "0.0______ g-m/s^2", status); 1192 expect(new DecimalFormat("##0.0####*_ 'g-m/s^2'", US, status), 1193 1.0/3, "0.33333__ g-m/s^2", status); 1194 1195 // Test padding before a sign 1196 const char *formatStr = "*x#,###,###,##0.0#;*x(###,###,##0.0#)"; 1197 expect2(new DecimalFormat(formatStr, US, status), 1198 int32_t(-10), "xxxxxxxxxx(10.0)", status); 1199 expect2(new DecimalFormat(formatStr, US, status), 1200 int32_t(-1000),"xxxxxxx(1,000.0)", status); 1201 expect2(new DecimalFormat(formatStr, US, status), 1202 int32_t(-1000000),"xxx(1,000,000.0)", status); 1203 expect2(new DecimalFormat(formatStr, US, status), 1204 -100.37, "xxxxxxxx(100.37)", status); 1205 expect2(new DecimalFormat(formatStr, US, status), 1206 -10456.37, "xxxxx(10,456.37)", status); 1207 expect2(new DecimalFormat(formatStr, US, status), 1208 -1120456.37, "xx(1,120,456.37)", status); 1209 expect2(new DecimalFormat(formatStr, US, status), 1210 -112045600.37, "(112,045,600.37)", status); 1211 expect2(new DecimalFormat(formatStr, US, status), 1212 -1252045600.37,"(1,252,045,600.37)", status); 1213 1214 expect2(new DecimalFormat(formatStr, US, status), 1215 int32_t(10), "xxxxxxxxxxxx10.0", status); 1216 expect2(new DecimalFormat(formatStr, US, status), 1217 int32_t(1000),"xxxxxxxxx1,000.0", status); 1218 expect2(new DecimalFormat(formatStr, US, status), 1219 int32_t(1000000),"xxxxx1,000,000.0", status); 1220 expect2(new DecimalFormat(formatStr, US, status), 1221 100.37, "xxxxxxxxxx100.37", status); 1222 expect2(new DecimalFormat(formatStr, US, status), 1223 10456.37, "xxxxxxx10,456.37", status); 1224 expect2(new DecimalFormat(formatStr, US, status), 1225 1120456.37, "xxxx1,120,456.37", status); 1226 expect2(new DecimalFormat(formatStr, US, status), 1227 112045600.37, "xx112,045,600.37", status); 1228 expect2(new DecimalFormat(formatStr, US, status), 1229 10252045600.37,"10,252,045,600.37", status); 1230 1231 1232 // Test padding between a sign and a number 1233 const char *formatStr2 = "#,###,###,##0.0#*x;(###,###,##0.0#*x)"; 1234 expect2(new DecimalFormat(formatStr2, US, status), 1235 int32_t(-10), "(10.0xxxxxxxxxx)", status); 1236 expect2(new DecimalFormat(formatStr2, US, status), 1237 int32_t(-1000),"(1,000.0xxxxxxx)", status); 1238 expect2(new DecimalFormat(formatStr2, US, status), 1239 int32_t(-1000000),"(1,000,000.0xxx)", status); 1240 expect2(new DecimalFormat(formatStr2, US, status), 1241 -100.37, "(100.37xxxxxxxx)", status); 1242 expect2(new DecimalFormat(formatStr2, US, status), 1243 -10456.37, "(10,456.37xxxxx)", status); 1244 expect2(new DecimalFormat(formatStr2, US, status), 1245 -1120456.37, "(1,120,456.37xx)", status); 1246 expect2(new DecimalFormat(formatStr2, US, status), 1247 -112045600.37, "(112,045,600.37)", status); 1248 expect2(new DecimalFormat(formatStr2, US, status), 1249 -1252045600.37,"(1,252,045,600.37)", status); 1250 1251 expect2(new DecimalFormat(formatStr2, US, status), 1252 int32_t(10), "10.0xxxxxxxxxxxx", status); 1253 expect2(new DecimalFormat(formatStr2, US, status), 1254 int32_t(1000),"1,000.0xxxxxxxxx", status); 1255 expect2(new DecimalFormat(formatStr2, US, status), 1256 int32_t(1000000),"1,000,000.0xxxxx", status); 1257 expect2(new DecimalFormat(formatStr2, US, status), 1258 100.37, "100.37xxxxxxxxxx", status); 1259 expect2(new DecimalFormat(formatStr2, US, status), 1260 10456.37, "10,456.37xxxxxxx", status); 1261 expect2(new DecimalFormat(formatStr2, US, status), 1262 1120456.37, "1,120,456.37xxxx", status); 1263 expect2(new DecimalFormat(formatStr2, US, status), 1264 112045600.37, "112,045,600.37xx", status); 1265 expect2(new DecimalFormat(formatStr2, US, status), 1266 10252045600.37,"10,252,045,600.37", status); 1267 1268 //testing the setPadCharacter(UnicodeString) and getPadCharacterString() 1269 DecimalFormat fmt("#", US, status); 1270 CHECK(status, "DecimalFormat constructor"); 1271 UnicodeString padString("P"); 1272 fmt.setPadCharacter(padString); 1273 expectPad(fmt, "*P##.##", DecimalFormat::kPadBeforePrefix, 5, padString); 1274 fmt.setPadCharacter((UnicodeString)"^"); 1275 expectPad(fmt, "*^#", DecimalFormat::kPadBeforePrefix, 1, (UnicodeString)"^"); 1276 //commented untill implementation is complete 1277 /* fmt.setPadCharacter((UnicodeString)"^^^"); 1278 expectPad(fmt, "*^^^#", DecimalFormat::kPadBeforePrefix, 3, (UnicodeString)"^^^"); 1279 padString.remove(); 1280 padString.append((UChar)0x0061); 1281 padString.append((UChar)0x0302); 1282 fmt.setPadCharacter(padString); 1283 UChar patternChars[]={0x002a, 0x0061, 0x0302, 0x0061, 0x0302, 0x0023, 0x0000}; 1284 UnicodeString pattern(patternChars); 1285 expectPad(fmt, pattern , DecimalFormat::kPadBeforePrefix, 4, padString); 1286 */ 1287 1288 } 1289 1290 /** 1291 * Upgrade to alphaWorks 1292 */ 1293 void NumberFormatTest::TestPatterns2(void) { 1294 UErrorCode status = U_ZERO_ERROR; 1295 DecimalFormatSymbols US(Locale::getUS(), status); 1296 CHECK(status, "DecimalFormatSymbols constructor"); 1297 1298 DecimalFormat fmt("#", US, status); 1299 CHECK(status, "DecimalFormat constructor"); 1300 1301 UChar hat = 0x005E; /*^*/ 1302 1303 expectPad(fmt, "*^#", DecimalFormat::kPadBeforePrefix, 1, hat); 1304 expectPad(fmt, "$*^#", DecimalFormat::kPadAfterPrefix, 2, hat); 1305 expectPad(fmt, "#*^", DecimalFormat::kPadBeforeSuffix, 1, hat); 1306 expectPad(fmt, "#$*^", DecimalFormat::kPadAfterSuffix, 2, hat); 1307 expectPad(fmt, "$*^$#", ILLEGAL); 1308 expectPad(fmt, "#$*^$", ILLEGAL); 1309 expectPad(fmt, "'pre'#,##0*x'post'", DecimalFormat::kPadBeforeSuffix, 1310 12, (UChar)0x0078 /*x*/); 1311 expectPad(fmt, "''#0*x", DecimalFormat::kPadBeforeSuffix, 1312 3, (UChar)0x0078 /*x*/); 1313 expectPad(fmt, "'I''ll'*a###.##", DecimalFormat::kPadAfterPrefix, 1314 10, (UChar)0x0061 /*a*/); 1315 1316 fmt.applyPattern("AA#,##0.00ZZ", status); 1317 CHECK(status, "applyPattern"); 1318 fmt.setPadCharacter(hat); 1319 1320 fmt.setFormatWidth(10); 1321 1322 fmt.setPadPosition(DecimalFormat::kPadBeforePrefix); 1323 expectPat(fmt, "*^AA#,##0.00ZZ"); 1324 1325 fmt.setPadPosition(DecimalFormat::kPadBeforeSuffix); 1326 expectPat(fmt, "AA#,##0.00*^ZZ"); 1327 1328 fmt.setPadPosition(DecimalFormat::kPadAfterSuffix); 1329 expectPat(fmt, "AA#,##0.00ZZ*^"); 1330 1331 // 12 3456789012 1332 UnicodeString exp("AA*^#,##0.00ZZ", ""); 1333 fmt.setFormatWidth(12); 1334 fmt.setPadPosition(DecimalFormat::kPadAfterPrefix); 1335 expectPat(fmt, exp); 1336 1337 fmt.setFormatWidth(13); 1338 // 12 34567890123 1339 expectPat(fmt, "AA*^##,##0.00ZZ"); 1340 1341 fmt.setFormatWidth(14); 1342 // 12 345678901234 1343 expectPat(fmt, "AA*^###,##0.00ZZ"); 1344 1345 fmt.setFormatWidth(15); 1346 // 12 3456789012345 1347 expectPat(fmt, "AA*^####,##0.00ZZ"); // This is the interesting case 1348 1349 fmt.setFormatWidth(16); 1350 // 12 34567890123456 1351 expectPat(fmt, "AA*^#,###,##0.00ZZ"); 1352 } 1353 1354 void NumberFormatTest::TestSurrogateSupport(void) { 1355 UErrorCode status = U_ZERO_ERROR; 1356 DecimalFormatSymbols custom(Locale::getUS(), status); 1357 CHECK(status, "DecimalFormatSymbols constructor"); 1358 1359 custom.setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, "decimal"); 1360 custom.setSymbol(DecimalFormatSymbols::kPlusSignSymbol, "plus"); 1361 custom.setSymbol(DecimalFormatSymbols::kMinusSignSymbol, " minus "); 1362 custom.setSymbol(DecimalFormatSymbols::kExponentialSymbol, "exponent"); 1363 1364 UnicodeString patternStr("*\\U00010000##.##", ""); 1365 patternStr = patternStr.unescape(); 1366 UnicodeString expStr("\\U00010000\\U00010000\\U00010000\\U000100000", ""); 1367 expStr = expStr.unescape(); 1368 expect2(new DecimalFormat(patternStr, custom, status), 1369 int32_t(0), expStr, status); 1370 1371 status = U_ZERO_ERROR; 1372 expect2(new DecimalFormat("*^##.##", custom, status), 1373 int32_t(0), "^^^^0", status); 1374 status = U_ZERO_ERROR; 1375 expect2(new DecimalFormat("##.##", custom, status), 1376 -1.3, " minus 1decimal3", status); 1377 status = U_ZERO_ERROR; 1378 expect2(new DecimalFormat("##0.0####E0 'g-m/s^2'", custom, status), 1379 int32_t(0), "0decimal0exponent0 g-m/s^2", status); 1380 status = U_ZERO_ERROR; 1381 expect(new DecimalFormat("##0.0####E0 'g-m/s^2'", custom, status), 1382 1.0/3, "333decimal333exponent minus 3 g-m/s^2", status); 1383 status = U_ZERO_ERROR; 1384 expect2(new DecimalFormat("##0.0#### 'g-m/s^2'", custom, status), 1385 int32_t(0), "0decimal0 g-m/s^2", status); 1386 status = U_ZERO_ERROR; 1387 expect(new DecimalFormat("##0.0#### 'g-m/s^2'", custom, status), 1388 1.0/3, "0decimal33333 g-m/s^2", status); 1389 1390 UnicodeString zero((UChar32)0x10000); 1391 custom.setSymbol(DecimalFormatSymbols::kZeroDigitSymbol, zero); 1392 expStr = UnicodeString("\\U00010001decimal\\U00010002\\U00010005\\U00010000", ""); 1393 expStr = expStr.unescape(); 1394 status = U_ZERO_ERROR; 1395 expect2(new DecimalFormat("##0.000", custom, status), 1396 1.25, expStr, status); 1397 1398 custom.setSymbol(DecimalFormatSymbols::kZeroDigitSymbol, (UChar)0x30); 1399 custom.setSymbol(DecimalFormatSymbols::kCurrencySymbol, "units of money"); 1400 custom.setSymbol(DecimalFormatSymbols::kMonetarySeparatorSymbol, "money separator"); 1401 patternStr = UNICODE_STRING_SIMPLE("0.00 \\u00A4' in your bank account'"); 1402 patternStr = patternStr.unescape(); 1403 expStr = UnicodeString(" minus 20money separator00 units of money in your bank account", ""); 1404 status = U_ZERO_ERROR; 1405 expect2(new DecimalFormat(patternStr, custom, status), 1406 int32_t(-20), expStr, status); 1407 1408 custom.setSymbol(DecimalFormatSymbols::kPercentSymbol, "percent"); 1409 patternStr = "'You''ve lost ' -0.00 %' of your money today'"; 1410 patternStr = patternStr.unescape(); 1411 expStr = UnicodeString(" minus You've lost minus 2000decimal00 percent of your money today", ""); 1412 status = U_ZERO_ERROR; 1413 expect2(new DecimalFormat(patternStr, custom, status), 1414 int32_t(-20), expStr, status); 1415 } 1416 1417 void NumberFormatTest::TestCurrencyPatterns(void) { 1418 int32_t i, locCount; 1419 const Locale* locs = NumberFormat::getAvailableLocales(locCount); 1420 for (i=0; i<locCount; ++i) { 1421 UErrorCode ec = U_ZERO_ERROR; 1422 NumberFormat* nf = NumberFormat::createCurrencyInstance(locs[i], ec); 1423 if (U_FAILURE(ec)) { 1424 errln("FAIL: Can't create NumberFormat(%s) - %s", locs[i].getName(), u_errorName(ec)); 1425 } else { 1426 // Make sure currency formats do not have a variable number 1427 // of fraction digits 1428 int32_t min = nf->getMinimumFractionDigits(); 1429 int32_t max = nf->getMaximumFractionDigits(); 1430 if (min != max) { 1431 UnicodeString a, b; 1432 nf->format(1.0, a); 1433 nf->format(1.125, b); 1434 errln((UnicodeString)"FAIL: " + locs[i].getName() + 1435 " min fraction digits != max fraction digits; " 1436 "x 1.0 => " + escape(a) + 1437 "; x 1.125 => " + escape(b)); 1438 } 1439 1440 // Make sure EURO currency formats have exactly 2 fraction digits 1441 if (nf->getDynamicClassID() == DecimalFormat::getStaticClassID()) { 1442 DecimalFormat* df = (DecimalFormat*) nf; 1443 if (u_strcmp(EUR, df->getCurrency()) == 0) { 1444 if (min != 2 || max != 2) { 1445 UnicodeString a; 1446 nf->format(1.0, a); 1447 errln((UnicodeString)"FAIL: " + locs[i].getName() + 1448 " is a EURO format but it does not have 2 fraction digits; " 1449 "x 1.0 => " + 1450 escape(a)); 1451 } 1452 } 1453 } 1454 } 1455 delete nf; 1456 } 1457 } 1458 1459 void NumberFormatTest::TestRegCurrency(void) { 1460 #if !UCONFIG_NO_SERVICE 1461 UErrorCode status = U_ZERO_ERROR; 1462 UChar USD[4]; 1463 ucurr_forLocale("en_US", USD, 4, &status); 1464 UChar YEN[4]; 1465 ucurr_forLocale("ja_JP", YEN, 4, &status); 1466 UChar TMP[4]; 1467 static const UChar QQQ[] = {0x51, 0x51, 0x51, 0}; 1468 if(U_FAILURE(status)) { 1469 errcheckln(status, "Unable to get currency for locale, error %s", u_errorName(status)); 1470 return; 1471 } 1472 1473 UCurrRegistryKey enkey = ucurr_register(YEN, "en_US", &status); 1474 UCurrRegistryKey enUSEUROkey = ucurr_register(QQQ, "en_US_EURO", &status); 1475 1476 ucurr_forLocale("en_US", TMP, 4, &status); 1477 if (u_strcmp(YEN, TMP) != 0) { 1478 errln("FAIL: didn't return YEN registered for en_US"); 1479 } 1480 1481 ucurr_forLocale("en_US_EURO", TMP, 4, &status); 1482 if (u_strcmp(QQQ, TMP) != 0) { 1483 errln("FAIL: didn't return QQQ for en_US_EURO"); 1484 } 1485 1486 int32_t fallbackLen = ucurr_forLocale("en_XX_BAR", TMP, 4, &status); 1487 if (fallbackLen) { 1488 errln("FAIL: tried to fallback en_XX_BAR"); 1489 } 1490 status = U_ZERO_ERROR; // reset 1491 1492 if (!ucurr_unregister(enkey, &status)) { 1493 errln("FAIL: couldn't unregister enkey"); 1494 } 1495 1496 ucurr_forLocale("en_US", TMP, 4, &status); 1497 if (u_strcmp(USD, TMP) != 0) { 1498 errln("FAIL: didn't return USD for en_US after unregister of en_US"); 1499 } 1500 status = U_ZERO_ERROR; // reset 1501 1502 ucurr_forLocale("en_US_EURO", TMP, 4, &status); 1503 if (u_strcmp(QQQ, TMP) != 0) { 1504 errln("FAIL: didn't return QQQ for en_US_EURO after unregister of en_US"); 1505 } 1506 1507 ucurr_forLocale("en_US_BLAH", TMP, 4, &status); 1508 if (u_strcmp(USD, TMP) != 0) { 1509 errln("FAIL: could not find USD for en_US_BLAH after unregister of en"); 1510 } 1511 status = U_ZERO_ERROR; // reset 1512 1513 if (!ucurr_unregister(enUSEUROkey, &status)) { 1514 errln("FAIL: couldn't unregister enUSEUROkey"); 1515 } 1516 1517 ucurr_forLocale("en_US_EURO", TMP, 4, &status); 1518 if (u_strcmp(EUR, TMP) != 0) { 1519 errln("FAIL: didn't return EUR for en_US_EURO after unregister of en_US_EURO"); 1520 } 1521 status = U_ZERO_ERROR; // reset 1522 #endif 1523 } 1524 1525 void NumberFormatTest::TestCurrencyNames(void) { 1526 // Do a basic check of getName() 1527 // USD { "US$", "US Dollar" } // 04/04/1792- 1528 UErrorCode ec = U_ZERO_ERROR; 1529 static const UChar USD[] = {0x55, 0x53, 0x44, 0}; /*USD*/ 1530 static const UChar USX[] = {0x55, 0x53, 0x58, 0}; /*USX*/ 1531 static const UChar CAD[] = {0x43, 0x41, 0x44, 0}; /*CAD*/ 1532 static const UChar ITL[] = {0x49, 0x54, 0x4C, 0}; /*ITL*/ 1533 UBool isChoiceFormat; 1534 int32_t len; 1535 const UBool possibleDataError = TRUE; 1536 // Warning: HARD-CODED LOCALE DATA in this test. If it fails, CHECK 1537 // THE LOCALE DATA before diving into the code. 1538 assertEquals("USD.getName(SYMBOL_NAME)", 1539 UnicodeString("$"), 1540 UnicodeString(ucurr_getName(USD, "en", 1541 UCURR_SYMBOL_NAME, 1542 &isChoiceFormat, &len, &ec)), 1543 possibleDataError); 1544 assertEquals("USD.getName(LONG_NAME)", 1545 UnicodeString("US Dollar"), 1546 UnicodeString(ucurr_getName(USD, "en", 1547 UCURR_LONG_NAME, 1548 &isChoiceFormat, &len, &ec)), 1549 possibleDataError); 1550 assertEquals("CAD.getName(SYMBOL_NAME)", 1551 UnicodeString("CA$"), 1552 UnicodeString(ucurr_getName(CAD, "en", 1553 UCURR_SYMBOL_NAME, 1554 &isChoiceFormat, &len, &ec)), 1555 possibleDataError); 1556 assertEquals("CAD.getName(SYMBOL_NAME)", 1557 UnicodeString("$"), 1558 UnicodeString(ucurr_getName(CAD, "en_CA", 1559 UCURR_SYMBOL_NAME, 1560 &isChoiceFormat, &len, &ec)), 1561 possibleDataError); 1562 assertEquals("USD.getName(SYMBOL_NAME)", 1563 UnicodeString("US$"), 1564 UnicodeString(ucurr_getName(USD, "en_AU", 1565 UCURR_SYMBOL_NAME, 1566 &isChoiceFormat, &len, &ec)), 1567 possibleDataError); 1568 assertEquals("CAD.getName(SYMBOL_NAME)", 1569 UnicodeString("CA$"), 1570 UnicodeString(ucurr_getName(CAD, "en_AU", 1571 UCURR_SYMBOL_NAME, 1572 &isChoiceFormat, &len, &ec)), 1573 possibleDataError); 1574 assertEquals("USX.getName(LONG_NAME)", 1575 UnicodeString("USX"), 1576 UnicodeString(ucurr_getName(USX, "en_US", 1577 UCURR_LONG_NAME, 1578 &isChoiceFormat, &len, &ec)), 1579 possibleDataError); 1580 assertSuccess("ucurr_getName", ec); 1581 1582 ec = U_ZERO_ERROR; 1583 1584 // Test that a default or fallback warning is being returned. JB 4239. 1585 ucurr_getName(CAD, "es_ES", UCURR_LONG_NAME, &isChoiceFormat, 1586 &len, &ec); 1587 assertTrue("ucurr_getName (es_ES fallback)", 1588 U_USING_FALLBACK_WARNING == ec, TRUE, possibleDataError); 1589 1590 ucurr_getName(CAD, "zh_TW", UCURR_LONG_NAME, &isChoiceFormat, 1591 &len, &ec); 1592 assertTrue("ucurr_getName (zh_TW fallback)", 1593 U_USING_FALLBACK_WARNING == ec, TRUE, possibleDataError); 1594 1595 ucurr_getName(CAD, "en_US", UCURR_LONG_NAME, &isChoiceFormat, 1596 &len, &ec); 1597 assertTrue("ucurr_getName (en_US default)", 1598 U_USING_DEFAULT_WARNING == ec || U_USING_FALLBACK_WARNING == ec, TRUE); 1599 1600 ucurr_getName(CAD, "vi", UCURR_LONG_NAME, &isChoiceFormat, 1601 &len, &ec); 1602 assertTrue("ucurr_getName (vi default)", 1603 U_USING_DEFAULT_WARNING == ec, TRUE); 1604 1605 // Test that a default warning is being returned when falling back to root. JB 4536. 1606 ucurr_getName(ITL, "cy", UCURR_LONG_NAME, &isChoiceFormat, 1607 &len, &ec); 1608 assertTrue("ucurr_getName (cy default to root)", 1609 U_USING_DEFAULT_WARNING == ec, TRUE); 1610 1611 // TODO add more tests later 1612 } 1613 1614 void NumberFormatTest::TestCurrencyUnit(void){ 1615 UErrorCode ec = U_ZERO_ERROR; 1616 static const UChar USD[] = {85, 83, 68, 0}; /*USD*/ 1617 CurrencyUnit cu(USD, ec); 1618 assertSuccess("CurrencyUnit", ec); 1619 1620 const UChar * r = cu.getISOCurrency(); // who is the buffer owner ? 1621 assertEquals("getISOCurrency()", USD, r); 1622 1623 CurrencyUnit cu2(cu); 1624 if (!(cu2 == cu)){ 1625 errln("CurrencyUnit copy constructed object should be same"); 1626 } 1627 1628 CurrencyUnit * cu3 = (CurrencyUnit *)cu.clone(); 1629 if (!(*cu3 == cu)){ 1630 errln("CurrencyUnit cloned object should be same"); 1631 } 1632 delete cu3; 1633 } 1634 1635 void NumberFormatTest::TestCurrencyAmount(void){ 1636 UErrorCode ec = U_ZERO_ERROR; 1637 static const UChar USD[] = {85, 83, 68, 0}; /*USD*/ 1638 CurrencyAmount ca(9, USD, ec); 1639 assertSuccess("CurrencyAmount", ec); 1640 1641 CurrencyAmount ca2(ca); 1642 if (!(ca2 == ca)){ 1643 errln("CurrencyAmount copy constructed object should be same"); 1644 } 1645 1646 ca2=ca; 1647 if (!(ca2 == ca)){ 1648 errln("CurrencyAmount assigned object should be same"); 1649 } 1650 1651 CurrencyAmount *ca3 = (CurrencyAmount *)ca.clone(); 1652 if (!(*ca3 == ca)){ 1653 errln("CurrencyAmount cloned object should be same"); 1654 } 1655 delete ca3; 1656 } 1657 1658 void NumberFormatTest::TestSymbolsWithBadLocale(void) { 1659 Locale locDefault; 1660 Locale locBad("x-crazy_ZZ_MY_SPECIAL_ADMINISTRATION_REGION_NEEDS_A_SPECIAL_VARIANT_WITH_A_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_REALLY_LONG_NAME"); 1661 UErrorCode status = U_ZERO_ERROR; 1662 UnicodeString intlCurrencySymbol((UChar)0xa4); 1663 1664 intlCurrencySymbol.append((UChar)0xa4); 1665 1666 logln("Current locale is %s", Locale::getDefault().getName()); 1667 Locale::setDefault(locBad, status); 1668 logln("Current locale is %s", Locale::getDefault().getName()); 1669 DecimalFormatSymbols mySymbols(status); 1670 if (status != U_USING_FALLBACK_WARNING) { 1671 errln("DecimalFormatSymbols should returned U_USING_FALLBACK_WARNING."); 1672 } 1673 if (strcmp(mySymbols.getLocale().getName(), locBad.getName()) != 0) { 1674 errln("DecimalFormatSymbols does not have the right locale."); 1675 } 1676 int symbolEnum = (int)DecimalFormatSymbols::kDecimalSeparatorSymbol; 1677 for (; symbolEnum < (int)DecimalFormatSymbols::kFormatSymbolCount; symbolEnum++) { 1678 logln(UnicodeString("DecimalFormatSymbols[") + symbolEnum + UnicodeString("] = ") 1679 + prettify(mySymbols.getSymbol((DecimalFormatSymbols::ENumberFormatSymbol)symbolEnum))); 1680 1681 if (mySymbols.getSymbol((DecimalFormatSymbols::ENumberFormatSymbol)symbolEnum).length() == 0 1682 && symbolEnum != (int)DecimalFormatSymbols::kGroupingSeparatorSymbol 1683 && symbolEnum != (int)DecimalFormatSymbols::kMonetaryGroupingSeparatorSymbol) 1684 { 1685 errln("DecimalFormatSymbols has an empty string at index %d.", symbolEnum); 1686 } 1687 } 1688 status = U_ZERO_ERROR; 1689 Locale::setDefault(locDefault, status); 1690 logln("Current locale is %s", Locale::getDefault().getName()); 1691 } 1692 1693 /** 1694 * Check that adoptDecimalFormatSymbols and setDecimalFormatSymbols 1695 * behave the same, except for memory ownership semantics. (No 1696 * version of this test on Java, since Java has only one method.) 1697 */ 1698 void NumberFormatTest::TestAdoptDecimalFormatSymbols(void) { 1699 UErrorCode ec = U_ZERO_ERROR; 1700 DecimalFormatSymbols *sym = new DecimalFormatSymbols(Locale::getUS(), ec); 1701 if (U_FAILURE(ec)) { 1702 errcheckln(ec, "Fail: DecimalFormatSymbols constructor - %s", u_errorName(ec)); 1703 delete sym; 1704 return; 1705 } 1706 UnicodeString pat(" #,##0.00"); 1707 pat.insert(0, (UChar)0x00A4); 1708 DecimalFormat fmt(pat, sym, ec); 1709 if (U_FAILURE(ec)) { 1710 errln("Fail: DecimalFormat constructor"); 1711 return; 1712 } 1713 1714 UnicodeString str; 1715 fmt.format(2350.75, str); 1716 if (str == "$ 2,350.75") { 1717 logln(str); 1718 } else { 1719 errln("Fail: " + str + ", expected $ 2,350.75"); 1720 } 1721 1722 sym = new DecimalFormatSymbols(Locale::getUS(), ec); 1723 if (U_FAILURE(ec)) { 1724 errln("Fail: DecimalFormatSymbols constructor"); 1725 delete sym; 1726 return; 1727 } 1728 sym->setSymbol(DecimalFormatSymbols::kCurrencySymbol, "Q"); 1729 fmt.adoptDecimalFormatSymbols(sym); 1730 1731 str.truncate(0); 1732 fmt.format(2350.75, str); 1733 if (str == "Q 2,350.75") { 1734 logln(str); 1735 } else { 1736 errln("Fail: adoptDecimalFormatSymbols -> " + str + ", expected Q 2,350.75"); 1737 } 1738 1739 sym = new DecimalFormatSymbols(Locale::getUS(), ec); 1740 if (U_FAILURE(ec)) { 1741 errln("Fail: DecimalFormatSymbols constructor"); 1742 delete sym; 1743 return; 1744 } 1745 DecimalFormat fmt2(pat, sym, ec); 1746 if (U_FAILURE(ec)) { 1747 errln("Fail: DecimalFormat constructor"); 1748 return; 1749 } 1750 1751 DecimalFormatSymbols sym2(Locale::getUS(), ec); 1752 if (U_FAILURE(ec)) { 1753 errln("Fail: DecimalFormatSymbols constructor"); 1754 return; 1755 } 1756 sym2.setSymbol(DecimalFormatSymbols::kCurrencySymbol, "Q"); 1757 fmt2.setDecimalFormatSymbols(sym2); 1758 1759 str.truncate(0); 1760 fmt2.format(2350.75, str); 1761 if (str == "Q 2,350.75") { 1762 logln(str); 1763 } else { 1764 errln("Fail: setDecimalFormatSymbols -> " + str + ", expected Q 2,350.75"); 1765 } 1766 } 1767 1768 void NumberFormatTest::TestPerMill() { 1769 UErrorCode ec = U_ZERO_ERROR; 1770 UnicodeString str; 1771 DecimalFormat fmt(ctou("###.###\\u2030"), ec); 1772 if (!assertSuccess("DecimalFormat ct", ec)) return; 1773 assertEquals("0.4857 x ###.###\\u2030", 1774 ctou("485.7\\u2030"), fmt.format(0.4857, str)); 1775 1776 DecimalFormatSymbols sym(Locale::getUS(), ec); 1777 sym.setSymbol(DecimalFormatSymbols::kPerMillSymbol, ctou("m")); 1778 DecimalFormat fmt2("", sym, ec); 1779 fmt2.applyLocalizedPattern("###.###m", ec); 1780 if (!assertSuccess("setup", ec)) return; 1781 str.truncate(0); 1782 assertEquals("0.4857 x ###.###m", 1783 "485.7m", fmt2.format(0.4857, str)); 1784 } 1785 1786 /** 1787 * Generic test for patterns that should be legal/illegal. 1788 */ 1789 void NumberFormatTest::TestIllegalPatterns() { 1790 // Test cases: 1791 // Prefix with "-:" for illegal patterns 1792 // Prefix with "+:" for legal patterns 1793 const char* DATA[] = { 1794 // Unquoted special characters in the suffix are illegal 1795 "-:000.000|###", 1796 "+:000.000'|###'", 1797 0 1798 }; 1799 for (int32_t i=0; DATA[i]; ++i) { 1800 const char* pat=DATA[i]; 1801 UBool valid = (*pat) == '+'; 1802 pat += 2; 1803 UErrorCode ec = U_ZERO_ERROR; 1804 DecimalFormat fmt(pat, ec); // locale doesn't matter here 1805 if (U_SUCCESS(ec) == valid) { 1806 logln("Ok: pattern \"%s\": %s", 1807 pat, u_errorName(ec)); 1808 } else { 1809 errcheckln(ec, "FAIL: pattern \"%s\" should have %s; got %s", 1810 pat, (valid?"succeeded":"failed"), 1811 u_errorName(ec)); 1812 } 1813 } 1814 } 1815 1816 //---------------------------------------------------------------------- 1817 1818 static const char* KEYWORDS[] = { 1819 /*0*/ "ref=", // <reference pattern to parse numbers> 1820 /*1*/ "loc=", // <locale for formats> 1821 /*2*/ "f:", // <pattern or '-'> <number> <exp. string> 1822 /*3*/ "fp:", // <pattern or '-'> <number> <exp. string> <exp. number> 1823 /*4*/ "rt:", // <pattern or '-'> <(exp.) number> <(exp.) string> 1824 /*5*/ "p:", // <pattern or '-'> <string> <exp. number> 1825 /*6*/ "perr:", // <pattern or '-'> <invalid string> 1826 /*7*/ "pat:", // <pattern or '-'> <exp. toPattern or '-' or 'err'> 1827 /*8*/ "fpc:", // <pattern or '-'> <curr.amt> <exp. string> <exp. curr.amt> 1828 0 1829 }; 1830 1831 /** 1832 * Return an integer representing the next token from this 1833 * iterator. The integer will be an index into the given list, or 1834 * -1 if there are no more tokens, or -2 if the token is not on 1835 * the list. 1836 */ 1837 static int32_t keywordIndex(const UnicodeString& tok) { 1838 for (int32_t i=0; KEYWORDS[i]!=0; ++i) { 1839 if (tok==KEYWORDS[i]) { 1840 return i; 1841 } 1842 } 1843 return -1; 1844 } 1845 1846 /** 1847 * Parse a CurrencyAmount using the given NumberFormat, with 1848 * the 'delim' character separating the number and the currency. 1849 */ 1850 static void parseCurrencyAmount(const UnicodeString& str, 1851 const NumberFormat& fmt, 1852 UChar delim, 1853 Formattable& result, 1854 UErrorCode& ec) { 1855 UnicodeString num, cur; 1856 int32_t i = str.indexOf(delim); 1857 str.extractBetween(0, i, num); 1858 str.extractBetween(i+1, INT32_MAX, cur); 1859 Formattable n; 1860 fmt.parse(num, n, ec); 1861 result.adoptObject(new CurrencyAmount(n, cur.getTerminatedBuffer(), ec)); 1862 } 1863 1864 void NumberFormatTest::TestCases() { 1865 UErrorCode ec = U_ZERO_ERROR; 1866 TextFile reader("NumberFormatTestCases.txt", "UTF8", ec); 1867 if (U_FAILURE(ec)) { 1868 dataerrln("Couldn't open NumberFormatTestCases.txt"); 1869 return; 1870 } 1871 TokenIterator tokens(&reader); 1872 1873 Locale loc("en", "US", ""); 1874 DecimalFormat *ref = 0, *fmt = 0; 1875 MeasureFormat *mfmt = 0; 1876 UnicodeString pat, tok, mloc, str, out, where, currAmt; 1877 Formattable n; 1878 1879 for (;;) { 1880 ec = U_ZERO_ERROR; 1881 if (!tokens.next(tok, ec)) { 1882 break; 1883 } 1884 where = UnicodeString("(") + tokens.getLineNumber() + ") "; 1885 int32_t cmd = keywordIndex(tok); 1886 switch (cmd) { 1887 case 0: 1888 // ref= <reference pattern> 1889 if (!tokens.next(tok, ec)) goto error; 1890 delete ref; 1891 ref = new DecimalFormat(tok, 1892 new DecimalFormatSymbols(Locale::getUS(), ec), ec); 1893 if (U_FAILURE(ec)) { 1894 dataerrln("Error constructing DecimalFormat"); 1895 goto error; 1896 } 1897 break; 1898 case 1: 1899 // loc= <locale> 1900 if (!tokens.next(tok, ec)) goto error; 1901 loc = Locale::createFromName(CharString(tok)); 1902 break; 1903 case 2: // f: 1904 case 3: // fp: 1905 case 4: // rt: 1906 case 5: // p: 1907 if (!tokens.next(tok, ec)) goto error; 1908 if (tok != "-") { 1909 pat = tok; 1910 delete fmt; 1911 fmt = new DecimalFormat(pat, new DecimalFormatSymbols(loc, ec), ec); 1912 if (U_FAILURE(ec)) { 1913 errln("FAIL: " + where + "Pattern \"" + pat + "\": " + u_errorName(ec)); 1914 ec = U_ZERO_ERROR; 1915 if (!tokens.next(tok, ec)) goto error; 1916 if (!tokens.next(tok, ec)) goto error; 1917 if (cmd == 3) { 1918 if (!tokens.next(tok, ec)) goto error; 1919 } 1920 continue; 1921 } 1922 } 1923 if (cmd == 2 || cmd == 3 || cmd == 4) { 1924 // f: <pattern or '-'> <number> <exp. string> 1925 // fp: <pattern or '-'> <number> <exp. string> <exp. number> 1926 // rt: <pattern or '-'> <number> <string> 1927 UnicodeString num; 1928 if (!tokens.next(num, ec)) goto error; 1929 if (!tokens.next(str, ec)) goto error; 1930 ref->parse(num, n, ec); 1931 assertSuccess("parse", ec); 1932 assertEquals(where + "\"" + pat + "\".format(" + num + ")", 1933 str, fmt->format(n, out.remove(), ec)); 1934 assertSuccess("format", ec); 1935 if (cmd == 3) { // fp: 1936 if (!tokens.next(num, ec)) goto error; 1937 ref->parse(num, n, ec); 1938 assertSuccess("parse", ec); 1939 } 1940 if (cmd != 2) { // != f: 1941 Formattable m; 1942 fmt->parse(str, m, ec); 1943 assertSuccess("parse", ec); 1944 assertEquals(where + "\"" + pat + "\".parse(\"" + str + "\")", 1945 n, m); 1946 } 1947 } 1948 // p: <pattern or '-'> <string to parse> <exp. number> 1949 else { 1950 UnicodeString expstr; 1951 if (!tokens.next(str, ec)) goto error; 1952 if (!tokens.next(expstr, ec)) goto error; 1953 Formattable exp, n; 1954 ref->parse(expstr, exp, ec); 1955 assertSuccess("parse", ec); 1956 fmt->parse(str, n, ec); 1957 assertSuccess("parse", ec); 1958 assertEquals(where + "\"" + pat + "\".parse(\"" + str + "\")", 1959 exp, n); 1960 } 1961 break; 1962 case 8: // fpc: 1963 if (!tokens.next(tok, ec)) goto error; 1964 if (tok != "-") { 1965 mloc = tok; 1966 delete mfmt; 1967 mfmt = MeasureFormat::createCurrencyFormat( 1968 Locale::createFromName(CharString(mloc)), ec); 1969 if (U_FAILURE(ec)) { 1970 errln("FAIL: " + where + "Loc \"" + mloc + "\": " + u_errorName(ec)); 1971 ec = U_ZERO_ERROR; 1972 if (!tokens.next(tok, ec)) goto error; 1973 if (!tokens.next(tok, ec)) goto error; 1974 if (!tokens.next(tok, ec)) goto error; 1975 continue; 1976 } 1977 } 1978 // fpc: <loc or '-'> <curr.amt> <exp. string> <exp. curr.amt> 1979 if (!tokens.next(currAmt, ec)) goto error; 1980 if (!tokens.next(str, ec)) goto error; 1981 parseCurrencyAmount(currAmt, *ref, (UChar)0x2F/*'/'*/, n, ec); 1982 if (assertSuccess("parseCurrencyAmount", ec)) { 1983 assertEquals(where + "getCurrencyFormat(" + mloc + ").format(" + currAmt + ")", 1984 str, mfmt->format(n, out.remove(), ec)); 1985 assertSuccess("format", ec); 1986 } 1987 if (!tokens.next(currAmt, ec)) goto error; 1988 parseCurrencyAmount(currAmt, *ref, (UChar)0x2F/*'/'*/, n, ec); 1989 if (assertSuccess("parseCurrencyAmount", ec)) { 1990 Formattable m; 1991 1992 mfmt->parseObject(str, m, ec); 1993 if (assertSuccess("parseCurrency", ec)) { 1994 assertEquals(where + "getCurrencyFormat(" + mloc + ").parse(\"" + str + "\")", 1995 n, m); 1996 } else { 1997 errln("FAIL: source " + str); 1998 } 1999 } 2000 break; 2001 case 6: 2002 // perr: <pattern or '-'> <invalid string> 2003 errln("FAIL: Under construction"); 2004 goto done; 2005 case 7: { 2006 // pat: <pattern> <exp. toPattern, or '-' or 'err'> 2007 UnicodeString testpat; 2008 UnicodeString exppat; 2009 if (!tokens.next(testpat, ec)) goto error; 2010 if (!tokens.next(exppat, ec)) goto error; 2011 UBool err = exppat == "err"; 2012 UBool existingPat = FALSE; 2013 if (testpat == "-") { 2014 if (err) { 2015 errln("FAIL: " + where + "Invalid command \"pat: - err\""); 2016 continue; 2017 } 2018 existingPat = TRUE; 2019 testpat = pat; 2020 } 2021 if (exppat == "-") exppat = testpat; 2022 DecimalFormat* f = 0; 2023 UErrorCode ec2 = U_ZERO_ERROR; 2024 if (existingPat) { 2025 f = fmt; 2026 } else { 2027 f = new DecimalFormat(testpat, ec2); 2028 } 2029 if (U_SUCCESS(ec2)) { 2030 if (err) { 2031 errln("FAIL: " + where + "Invalid pattern \"" + testpat + 2032 "\" was accepted"); 2033 } else { 2034 UnicodeString pat2; 2035 assertEquals(where + "\"" + testpat + "\".toPattern()", 2036 exppat, f->toPattern(pat2)); 2037 } 2038 } else { 2039 if (err) { 2040 logln("Ok: " + where + "Invalid pattern \"" + testpat + 2041 "\" failed: " + u_errorName(ec2)); 2042 } else { 2043 errln("FAIL: " + where + "Valid pattern \"" + testpat + 2044 "\" failed: " + u_errorName(ec2)); 2045 } 2046 } 2047 if (!existingPat) delete f; 2048 } break; 2049 case -1: 2050 errln("FAIL: " + where + "Unknown command \"" + tok + "\""); 2051 goto done; 2052 } 2053 } 2054 goto done; 2055 2056 error: 2057 if (U_SUCCESS(ec)) { 2058 errln("FAIL: Unexpected EOF"); 2059 } else { 2060 errcheckln(ec, "FAIL: " + where + "Unexpected " + u_errorName(ec)); 2061 } 2062 2063 done: 2064 delete mfmt; 2065 delete fmt; 2066 delete ref; 2067 } 2068 2069 2070 //---------------------------------------------------------------------- 2071 // Support methods 2072 //---------------------------------------------------------------------- 2073 2074 UBool NumberFormatTest::equalValue(const Formattable& a, const Formattable& b) { 2075 if (a.getType() == b.getType()) { 2076 return a == b; 2077 } 2078 2079 if (a.getType() == Formattable::kLong) { 2080 if (b.getType() == Formattable::kInt64) { 2081 return a.getLong() == b.getLong(); 2082 } else if (b.getType() == Formattable::kDouble) { 2083 return (double) a.getLong() == b.getDouble(); // TODO check use of double instead of long 2084 } 2085 } else if (a.getType() == Formattable::kDouble) { 2086 if (b.getType() == Formattable::kLong) { 2087 return a.getDouble() == (double) b.getLong(); 2088 } else if (b.getType() == Formattable::kInt64) { 2089 return a.getDouble() == (double)b.getInt64(); 2090 } 2091 } else if (a.getType() == Formattable::kInt64) { 2092 if (b.getType() == Formattable::kLong) { 2093 return a.getInt64() == (int64_t)b.getLong(); 2094 } else if (b.getType() == Formattable::kDouble) { 2095 return a.getInt64() == (int64_t)b.getDouble(); 2096 } 2097 } 2098 return FALSE; 2099 } 2100 2101 void NumberFormatTest::expect3(NumberFormat& fmt, const Formattable& n, const UnicodeString& str) { 2102 // Don't round-trip format test, since we explicitly do it 2103 expect_rbnf(fmt, n, str, FALSE); 2104 expect_rbnf(fmt, str, n); 2105 } 2106 2107 void NumberFormatTest::expect2(NumberFormat& fmt, const Formattable& n, const UnicodeString& str) { 2108 // Don't round-trip format test, since we explicitly do it 2109 expect(fmt, n, str, FALSE); 2110 expect(fmt, str, n); 2111 } 2112 2113 void NumberFormatTest::expect2(NumberFormat* fmt, const Formattable& n, 2114 const UnicodeString& exp, 2115 UErrorCode status) { 2116 if (U_FAILURE(status)) { 2117 errln("FAIL: NumberFormat constructor"); 2118 } else { 2119 expect2(*fmt, n, exp); 2120 } 2121 delete fmt; 2122 } 2123 2124 void NumberFormatTest::expect(NumberFormat& fmt, const UnicodeString& str, const Formattable& n) { 2125 UErrorCode status = U_ZERO_ERROR; 2126 Formattable num; 2127 fmt.parse(str, num, status); 2128 if (U_FAILURE(status)) { 2129 errln(UnicodeString("FAIL: Parse failed for \"") + str + "\""); 2130 return; 2131 } 2132 UnicodeString pat; 2133 ((DecimalFormat*) &fmt)->toPattern(pat); 2134 if (equalValue(num, n)) { 2135 logln(UnicodeString("Ok \"") + str + "\" x " + 2136 pat + " = " + 2137 toString(num)); 2138 } else { 2139 errln(UnicodeString("FAIL \"") + str + "\" x " + 2140 pat + " = " + 2141 toString(num) + ", expected " + toString(n)); 2142 } 2143 } 2144 2145 void NumberFormatTest::expect_rbnf(NumberFormat& fmt, const UnicodeString& str, const Formattable& n) { 2146 UErrorCode status = U_ZERO_ERROR; 2147 Formattable num; 2148 fmt.parse(str, num, status); 2149 if (U_FAILURE(status)) { 2150 errln(UnicodeString("FAIL: Parse failed for \"") + str + "\""); 2151 return; 2152 } 2153 if (equalValue(num, n)) { 2154 logln(UnicodeString("Ok \"") + str + " = " + 2155 toString(num)); 2156 } else { 2157 errln(UnicodeString("FAIL \"") + str + " = " + 2158 toString(num) + ", expected " + toString(n)); 2159 } 2160 } 2161 2162 void NumberFormatTest::expect_rbnf(NumberFormat& fmt, const Formattable& n, 2163 const UnicodeString& exp, UBool rt) { 2164 UnicodeString saw; 2165 FieldPosition pos; 2166 UErrorCode status = U_ZERO_ERROR; 2167 fmt.format(n, saw, pos, status); 2168 CHECK(status, "NumberFormat::format"); 2169 if (saw == exp) { 2170 logln(UnicodeString("Ok ") + toString(n) + 2171 " = \"" + 2172 escape(saw) + "\""); 2173 // We should be able to round-trip the formatted string => 2174 // number => string (but not the other way around: number 2175 // => string => number2, might have number2 != number): 2176 if (rt) { 2177 Formattable n2; 2178 fmt.parse(exp, n2, status); 2179 if (U_FAILURE(status)) { 2180 errln(UnicodeString("FAIL: Parse failed for \"") + exp + "\""); 2181 return; 2182 } 2183 UnicodeString saw2; 2184 fmt.format(n2, saw2, pos, status); 2185 CHECK(status, "NumberFormat::format"); 2186 if (saw2 != exp) { 2187 errln((UnicodeString)"FAIL \"" + exp + "\" => " + toString(n2) + 2188 " => \"" + saw2 + "\""); 2189 } 2190 } 2191 } else { 2192 errln(UnicodeString("FAIL ") + toString(n) + 2193 " = \"" + 2194 escape(saw) + "\", expected \"" + exp + "\""); 2195 } 2196 } 2197 2198 void NumberFormatTest::expect(NumberFormat& fmt, const Formattable& n, 2199 const UnicodeString& exp, UBool rt) { 2200 UnicodeString saw; 2201 FieldPosition pos; 2202 UErrorCode status = U_ZERO_ERROR; 2203 fmt.format(n, saw, pos, status); 2204 CHECK(status, "NumberFormat::format"); 2205 UnicodeString pat; 2206 ((DecimalFormat*) &fmt)->toPattern(pat); 2207 if (saw == exp) { 2208 logln(UnicodeString("Ok ") + toString(n) + " x " + 2209 escape(pat) + " = \"" + 2210 escape(saw) + "\""); 2211 // We should be able to round-trip the formatted string => 2212 // number => string (but not the other way around: number 2213 // => string => number2, might have number2 != number): 2214 if (rt) { 2215 Formattable n2; 2216 fmt.parse(exp, n2, status); 2217 if (U_FAILURE(status)) { 2218 errln(UnicodeString("FAIL: Parse failed for \"") + exp + "\""); 2219 return; 2220 } 2221 UnicodeString saw2; 2222 fmt.format(n2, saw2, pos, status); 2223 CHECK(status, "NumberFormat::format"); 2224 if (saw2 != exp) { 2225 errln((UnicodeString)"FAIL \"" + exp + "\" => " + toString(n2) + 2226 " => \"" + saw2 + "\""); 2227 } 2228 } 2229 } else { 2230 errln(UnicodeString("FAIL ") + toString(n) + " x " + 2231 escape(pat) + " = \"" + 2232 escape(saw) + "\", expected \"" + exp + "\""); 2233 } 2234 } 2235 2236 void NumberFormatTest::expect(NumberFormat* fmt, const Formattable& n, 2237 const UnicodeString& exp, 2238 UErrorCode status) { 2239 if (U_FAILURE(status)) { 2240 errln("FAIL: NumberFormat constructor"); 2241 } else { 2242 expect(*fmt, n, exp); 2243 } 2244 delete fmt; 2245 } 2246 2247 void NumberFormatTest::expectCurrency(NumberFormat& nf, const Locale& locale, 2248 double value, const UnicodeString& string) { 2249 UErrorCode ec = U_ZERO_ERROR; 2250 DecimalFormat& fmt = * (DecimalFormat*) &nf; 2251 const UChar DEFAULT_CURR[] = {45/*-*/,0}; 2252 UChar curr[4]; 2253 u_strcpy(curr, DEFAULT_CURR); 2254 if (*locale.getLanguage() != 0) { 2255 ucurr_forLocale(locale.getName(), curr, 4, &ec); 2256 assertSuccess("ucurr_forLocale", ec); 2257 fmt.setCurrency(curr, ec); 2258 assertSuccess("DecimalFormat::setCurrency", ec); 2259 fmt.setCurrency(curr); //Deprecated variant, for coverage only 2260 } 2261 UnicodeString s; 2262 fmt.format(value, s); 2263 s.findAndReplace((UChar32)0x00A0, (UChar32)0x0020); 2264 2265 // Default display of the number yields "1234.5599999999999" 2266 // instead of "1234.56". Use a formatter to fix this. 2267 NumberFormat* f = 2268 NumberFormat::createInstance(Locale::getUS(), ec); 2269 UnicodeString v; 2270 if (U_FAILURE(ec)) { 2271 // Oops; bad formatter. Use default op+= display. 2272 v = (UnicodeString)"" + value; 2273 } else { 2274 f->setMaximumFractionDigits(4); 2275 f->setGroupingUsed(FALSE); 2276 f->format(value, v); 2277 } 2278 delete f; 2279 2280 if (s == string) { 2281 logln((UnicodeString)"Ok: " + v + " x " + curr + " => " + prettify(s)); 2282 } else { 2283 errln((UnicodeString)"FAIL: " + v + " x " + curr + " => " + prettify(s) + 2284 ", expected " + prettify(string)); 2285 } 2286 } 2287 2288 void NumberFormatTest::expectPat(DecimalFormat& fmt, const UnicodeString& exp) { 2289 UnicodeString pat; 2290 fmt.toPattern(pat); 2291 if (pat == exp) { 2292 logln(UnicodeString("Ok \"") + pat + "\""); 2293 } else { 2294 errln(UnicodeString("FAIL \"") + pat + "\", expected \"" + exp + "\""); 2295 } 2296 } 2297 2298 void NumberFormatTest::expectPad(DecimalFormat& fmt, const UnicodeString& pat, 2299 int32_t pos) { 2300 expectPad(fmt, pat, pos, 0, (UnicodeString)""); 2301 } 2302 void NumberFormatTest::expectPad(DecimalFormat& fmt, const UnicodeString& pat, 2303 int32_t pos, int32_t width, UChar pad) { 2304 expectPad(fmt, pat, pos, width, UnicodeString(pad)); 2305 } 2306 void NumberFormatTest::expectPad(DecimalFormat& fmt, const UnicodeString& pat, 2307 int32_t pos, int32_t width, const UnicodeString& pad) { 2308 int32_t apos = 0, awidth = 0; 2309 UnicodeString apadStr; 2310 UErrorCode status = U_ZERO_ERROR; 2311 fmt.applyPattern(pat, status); 2312 if (U_SUCCESS(status)) { 2313 apos = fmt.getPadPosition(); 2314 awidth = fmt.getFormatWidth(); 2315 apadStr=fmt.getPadCharacterString(); 2316 } else { 2317 apos = -1; 2318 awidth = width; 2319 apadStr = pad; 2320 } 2321 if (apos == pos && awidth == width && apadStr == pad) { 2322 UnicodeString infoStr; 2323 if (pos == ILLEGAL) { 2324 infoStr = UnicodeString(" width=", "") + awidth + UnicodeString(" pad=", "") + apadStr; 2325 } 2326 logln(UnicodeString("Ok \"") + pat + "\" pos=" + apos + infoStr); 2327 } else { 2328 errln(UnicodeString("FAIL \"") + pat + "\" pos=" + apos + 2329 " width=" + awidth + " pad=" + apadStr + 2330 ", expected " + pos + " " + width + " " + pad); 2331 } 2332 } 2333 void NumberFormatTest::TestJB3832(){ 2334 const char* localeID = "pt_PT@currency=PTE"; 2335 Locale loc(localeID); 2336 UErrorCode status = U_ZERO_ERROR; 2337 UnicodeString expected(CharsToUnicodeString("1,150$50\\u00A0Esc.")); 2338 UnicodeString s; 2339 NumberFormat* currencyFmt = NumberFormat::createCurrencyInstance(loc, status); 2340 if(U_FAILURE(status)){ 2341 dataerrln("Could not create currency formatter for locale %s - %s", localeID, u_errorName(status)); 2342 return; 2343 } 2344 currencyFmt->format(1150.50, s); 2345 if(s!=expected){ 2346 errln(UnicodeString("FAIL: Expected: ")+expected 2347 + UnicodeString(" Got: ") + s 2348 + UnicodeString( " for locale: ")+ UnicodeString(localeID) ); 2349 } 2350 if (U_FAILURE(status)){ 2351 errln("FAIL: Status %s", u_errorName(status)); 2352 } 2353 delete currencyFmt; 2354 } 2355 2356 void NumberFormatTest::TestHost() 2357 { 2358 #ifdef U_WINDOWS 2359 Win32NumberTest::testLocales(this); 2360 #endif 2361 for (NumberFormat::EStyles k = NumberFormat::kNumberStyle; 2362 k < NumberFormat::kStyleCount; k = (NumberFormat::EStyles)(k+1)) { 2363 UErrorCode status = U_ZERO_ERROR; 2364 Locale loc("en_US@compat=host"); 2365 NumberFormat *full = NumberFormat::createInstance(loc, status); 2366 if (full == NULL || U_FAILURE(status)) { 2367 dataerrln("FAIL: Can't create number instance for host - %s", u_errorName(status)); 2368 return; 2369 } 2370 UnicodeString result1; 2371 Formattable number(10.00); 2372 full->format(number, result1, status); 2373 if (U_FAILURE(status)) { 2374 errln("FAIL: Can't format for host"); 2375 return; 2376 } 2377 Formattable formattable; 2378 full->parse(result1, formattable, status); 2379 if (U_FAILURE(status)) { 2380 errln("FAIL: Can't parse for host"); 2381 return; 2382 } 2383 delete full; 2384 } 2385 } 2386 2387 void NumberFormatTest::TestHostClone() 2388 { 2389 /* 2390 Verify that a cloned formatter gives the same results 2391 and is useable after the original has been deleted. 2392 */ 2393 // This is mainly important on Windows. 2394 UErrorCode status = U_ZERO_ERROR; 2395 Locale loc("en_US@compat=host"); 2396 UDate now = Calendar::getNow(); 2397 NumberFormat *full = NumberFormat::createInstance(loc, status); 2398 if (full == NULL || U_FAILURE(status)) { 2399 dataerrln("FAIL: Can't create Relative date instance - %s", u_errorName(status)); 2400 return; 2401 } 2402 UnicodeString result1; 2403 full->format(now, result1, status); 2404 Format *fullClone = full->clone(); 2405 delete full; 2406 full = NULL; 2407 2408 UnicodeString result2; 2409 fullClone->format(now, result2, status); 2410 if (U_FAILURE(status)) { 2411 errln("FAIL: format failure."); 2412 } 2413 if (result1 != result2) { 2414 errln("FAIL: Clone returned different result from non-clone."); 2415 } 2416 delete fullClone; 2417 } 2418 2419 void NumberFormatTest::TestCurrencyFormat() 2420 { 2421 // This test is here to increase code coverage. 2422 UErrorCode status = U_ZERO_ERROR; 2423 MeasureFormat *cloneObj; 2424 UnicodeString str; 2425 Formattable toFormat, result; 2426 static const UChar ISO_CODE[4] = {0x0047, 0x0042, 0x0050, 0}; 2427 2428 Locale saveDefaultLocale = Locale::getDefault(); 2429 Locale::setDefault( Locale::getUK(), status ); 2430 if (U_FAILURE(status)) { 2431 errln("couldn't set default Locale!"); 2432 return; 2433 } 2434 2435 MeasureFormat *measureObj = MeasureFormat::createCurrencyFormat(status); 2436 Locale::setDefault( saveDefaultLocale, status ); 2437 if (U_FAILURE(status)){ 2438 dataerrln("FAIL: Status %s", u_errorName(status)); 2439 return; 2440 } 2441 cloneObj = (MeasureFormat *)measureObj->clone(); 2442 if (cloneObj == NULL) { 2443 errln("Clone doesn't work"); 2444 return; 2445 } 2446 toFormat.adoptObject(new CurrencyAmount(1234.56, ISO_CODE, status)); 2447 measureObj->format(toFormat, str, status); 2448 measureObj->parseObject(str, result, status); 2449 if (U_FAILURE(status)){ 2450 errln("FAIL: Status %s", u_errorName(status)); 2451 } 2452 if (result != toFormat) { 2453 errln("measureObj does not round trip. Formatted string was \"" + str + "\" Got: " + toString(result) + " Expected: " + toString(toFormat)); 2454 } 2455 status = U_ZERO_ERROR; 2456 str.truncate(0); 2457 cloneObj->format(toFormat, str, status); 2458 cloneObj->parseObject(str, result, status); 2459 if (U_FAILURE(status)){ 2460 errln("FAIL: Status %s", u_errorName(status)); 2461 } 2462 if (result != toFormat) { 2463 errln("Clone does not round trip. Formatted string was \"" + str + "\" Got: " + toString(result) + " Expected: " + toString(toFormat)); 2464 } 2465 if (*measureObj != *cloneObj) { 2466 errln("Cloned object is not equal to the original object"); 2467 } 2468 delete measureObj; 2469 delete cloneObj; 2470 2471 status = U_USELESS_COLLATOR_ERROR; 2472 if (MeasureFormat::createCurrencyFormat(status) != NULL) { 2473 errln("createCurrencyFormat should have returned NULL."); 2474 } 2475 } 2476 2477 /* Port of ICU4J rounding test. */ 2478 void NumberFormatTest::TestRounding() { 2479 UErrorCode status = U_ZERO_ERROR; 2480 DecimalFormat *df = (DecimalFormat*)NumberFormat::createCurrencyInstance(Locale::getEnglish(), status); 2481 2482 if (U_FAILURE(status)) { 2483 dataerrln("Unable to create decimal formatter. - %s", u_errorName(status)); 2484 return; 2485 } 2486 2487 int roundingIncrements[]={1, 2, 5, 20, 50, 100}; 2488 int testValues[]={0, 300}; 2489 2490 for (int j=0; j<2; j++) { 2491 for (int mode=DecimalFormat::kRoundUp;mode<DecimalFormat::kRoundHalfEven;mode++) { 2492 df->setRoundingMode((DecimalFormat::ERoundingMode)mode); 2493 for (int increment=0; increment<6; increment++) { 2494 double base=testValues[j]; 2495 double rInc=roundingIncrements[increment]; 2496 checkRounding(df, base, 20, rInc); 2497 rInc=1.000000000/rInc; 2498 checkRounding(df, base, 20, rInc); 2499 } 2500 } 2501 } 2502 delete df; 2503 } 2504 2505 void NumberFormatTest::checkRounding(DecimalFormat* df, double base, int iterations, double increment) { 2506 df->setRoundingIncrement(increment); 2507 double lastParsed=INT32_MIN; //Intger.MIN_VALUE 2508 for (int i=-iterations; i<=iterations;i++) { 2509 double iValue=base+(increment*(i*0.1)); 2510 double smallIncrement=0.00000001; 2511 if (iValue!=0) { 2512 smallIncrement*=iValue; 2513 } 2514 //we not only test the value, but some values in a small range around it 2515 lastParsed=checkRound(df, iValue-smallIncrement, lastParsed); 2516 lastParsed=checkRound(df, iValue, lastParsed); 2517 lastParsed=checkRound(df, iValue+smallIncrement, lastParsed); 2518 } 2519 } 2520 2521 double NumberFormatTest::checkRound(DecimalFormat* df, double iValue, double lastParsed) { 2522 UErrorCode status=U_ZERO_ERROR; 2523 UnicodeString formattedDecimal; 2524 double parsed; 2525 Formattable result; 2526 df->format(iValue, formattedDecimal, status); 2527 2528 if (U_FAILURE(status)) { 2529 errln("Error formatting number."); 2530 } 2531 2532 df->parse(formattedDecimal, result, status); 2533 2534 if (U_FAILURE(status)) { 2535 errln("Error parsing number."); 2536 } 2537 2538 parsed=result.getDouble(); 2539 2540 if (lastParsed>parsed) { 2541 errln("Rounding wrong direction! %d > %d", lastParsed, parsed); 2542 } 2543 2544 return lastParsed; 2545 } 2546 2547 void NumberFormatTest::TestNonpositiveMultiplier() { 2548 UErrorCode status = U_ZERO_ERROR; 2549 DecimalFormatSymbols US(Locale::getUS(), status); 2550 CHECK(status, "DecimalFormatSymbols constructor"); 2551 DecimalFormat df(UnicodeString("0"), US, status); 2552 CHECK(status, "DecimalFormat(0)"); 2553 2554 // test zero multiplier 2555 2556 int32_t mult = df.getMultiplier(); 2557 df.setMultiplier(0); 2558 if (df.getMultiplier() != mult) { 2559 errln("DecimalFormat.setMultiplier(0) did not ignore its zero input"); 2560 } 2561 2562 // test negative multiplier 2563 2564 df.setMultiplier(-1); 2565 if (df.getMultiplier() != -1) { 2566 errln("DecimalFormat.setMultiplier(-1) ignored its negative input"); 2567 return; 2568 } 2569 2570 expect(df, "1122.123", -1122.123); 2571 expect(df, "-1122.123", 1122.123); 2572 expect(df, "1.2", -1.2); 2573 expect(df, "-1.2", 1.2); 2574 2575 // Note: the tests with the final parameter of FALSE will not round trip. 2576 // The initial numeric value will format correctly, after the multiplier. 2577 // Parsing the formatted text will be out-of-range for an int64, however. 2578 // The expect() function could be modified to detect this and fall back 2579 // to looking at the decimal parsed value, but it doesn't. 2580 expect(df, U_INT64_MIN, "9223372036854775808", FALSE); 2581 expect(df, U_INT64_MIN+1, "9223372036854775807"); 2582 expect(df, (int64_t)-123, "123"); 2583 expect(df, (int64_t)123, "-123"); 2584 expect(df, U_INT64_MAX-1, "-9223372036854775806"); 2585 expect(df, U_INT64_MAX, "-9223372036854775807"); 2586 2587 df.setMultiplier(-2); 2588 expect(df, -(U_INT64_MIN/2)-1, "-9223372036854775806"); 2589 expect(df, -(U_INT64_MIN/2), "-9223372036854775808"); 2590 expect(df, -(U_INT64_MIN/2)+1, "-9223372036854775810", FALSE); 2591 2592 df.setMultiplier(-7); 2593 expect(df, -(U_INT64_MAX/7)-1, "9223372036854775814", FALSE); 2594 expect(df, -(U_INT64_MAX/7), "9223372036854775807"); 2595 expect(df, -(U_INT64_MAX/7)+1, "9223372036854775800"); 2596 2597 // TODO: uncomment (and fix up) all the following int64_t tests once BigInteger is ported 2598 // (right now the big numbers get turned into doubles and lose tons of accuracy) 2599 //expect2(df, U_INT64_MAX, Int64ToUnicodeString(-U_INT64_MAX)); 2600 //expect2(df, U_INT64_MIN, UnicodeString(Int64ToUnicodeString(U_INT64_MIN), 1)); 2601 //expect2(df, U_INT64_MAX / 2, Int64ToUnicodeString(-(U_INT64_MAX / 2))); 2602 //expect2(df, U_INT64_MIN / 2, Int64ToUnicodeString(-(U_INT64_MIN / 2))); 2603 2604 // TODO: uncomment (and fix up) once BigDecimal is ported and DecimalFormat can handle it 2605 //expect2(df, BigDecimal.valueOf(Long.MAX_VALUE), BigDecimal.valueOf(Long.MAX_VALUE).negate().toString()); 2606 //expect2(df, BigDecimal.valueOf(Long.MIN_VALUE), BigDecimal.valueOf(Long.MIN_VALUE).negate().toString()); 2607 //expect2(df, java.math.BigDecimal.valueOf(Long.MAX_VALUE), java.math.BigDecimal.valueOf(Long.MAX_VALUE).negate().toString()); 2608 //expect2(df, java.math.BigDecimal.valueOf(Long.MIN_VALUE), java.math.BigDecimal.valueOf(Long.MIN_VALUE).negate().toString()); 2609 } 2610 2611 2612 void 2613 NumberFormatTest::TestSpaceParsing() { 2614 // the data are: 2615 // the string to be parsed, parsed position, parsed error index 2616 const char* DATA[][3] = { 2617 {"$124", "4", "-1"}, 2618 {"$124 $124", "4", "-1"}, 2619 {"$124 ", "4", "-1"}, 2620 //{"$ 124 ", "5", "-1"}, // TODO: need to handle space correctly 2621 //{"$\\u00A0124 ", "5", "-1"}, // TODO: need to handle space correctly 2622 {"$ 124 ", "0", "0"}, 2623 {"$\\u00A0124 ", "0", "0"}, 2624 {" $ 124 ", "0", "0"}, // TODO: need to handle space correctly 2625 {"124$", "0", "3"}, // TODO: need to handle space correctly 2626 // {"124 $", "5", "-1"}, TODO: OK or not, need currency spacing rule 2627 {"124 $", "0", "3"}, 2628 }; 2629 UErrorCode status = U_ZERO_ERROR; 2630 NumberFormat* foo = NumberFormat::createCurrencyInstance(status); 2631 if (U_FAILURE(status)) { 2632 delete foo; 2633 return; 2634 } 2635 for (uint32_t i = 0; i < sizeof(DATA)/sizeof(DATA[0]); ++i) { 2636 ParsePosition parsePosition(0); 2637 UnicodeString stringToBeParsed = ctou(DATA[i][0]); 2638 int parsedPosition = atoi(DATA[i][1]); 2639 int errorIndex = atoi(DATA[i][2]); 2640 Formattable result; 2641 foo->parse(stringToBeParsed, result, parsePosition); 2642 if (parsePosition.getIndex() != parsedPosition || 2643 parsePosition.getErrorIndex() != errorIndex) { 2644 errln("FAILED parse " + stringToBeParsed + "; wrong position, expected: (" + parsedPosition + ", " + errorIndex + "); got (" + parsePosition.getIndex() + ", " + parsePosition.getErrorIndex() + ")"); 2645 } 2646 if (parsePosition.getErrorIndex() == -1 && 2647 result.getType() == Formattable::kLong && 2648 result.getLong() != 124) { 2649 errln("FAILED parse " + stringToBeParsed + "; wrong number, expect: 124, got " + result.getLong()); 2650 } 2651 } 2652 delete foo; 2653 } 2654 2655 /** 2656 * Test using various numbering systems and numbering system keyword. 2657 */ 2658 void NumberFormatTest::TestNumberingSystems() { 2659 UErrorCode ec = U_ZERO_ERROR; 2660 2661 Locale loc1("en", "US", "", "numbers=thai"); 2662 Locale loc2("en", "US", "", "numbers=hebr"); 2663 Locale loc3("en", "US", "", "numbers=arabext"); 2664 Locale loc4("en", "US", "", "numbers=foobar"); 2665 2666 NumberFormat* fmt1= NumberFormat::createInstance(loc1, ec); 2667 if (U_FAILURE(ec)) { 2668 dataerrln("FAIL: getInstance(en_US@numbers=thai) - %s", u_errorName(ec)); 2669 } 2670 NumberFormat* fmt2= NumberFormat::createInstance(loc2, ec); 2671 if (U_FAILURE(ec)) { 2672 dataerrln("FAIL: getInstance(en_US@numbers=hebr) - %s", u_errorName(ec)); 2673 } 2674 NumberFormat* fmt3= NumberFormat::createInstance(loc3, ec); 2675 if (U_FAILURE(ec)) { 2676 dataerrln("FAIL: getInstance(en_US@numbers=arabext) - %s", u_errorName(ec)); 2677 } 2678 2679 if (U_SUCCESS(ec) && fmt1 != NULL && fmt2 != NULL && fmt3 != NULL) { 2680 expect2(*fmt1, 1234.567, CharsToUnicodeString("\\u0E51,\\u0E52\\u0E53\\u0E54.\\u0E55\\u0E56\\u0E57")); 2681 expect3(*fmt2, 5678.0, CharsToUnicodeString("\\u05D4\\u05F3\\u05EA\\u05E8\\u05E2\\u05F4\\u05D7")); 2682 expect2(*fmt3, 1234.567, CharsToUnicodeString("\\u06F1,\\u06F2\\u06F3\\u06F4.\\u06F5\\u06F6\\u06F7")); 2683 } 2684 2685 // Test bogus keyword value 2686 NumberFormat* fmt4= NumberFormat::createInstance(loc4, ec); 2687 if ( ec != U_UNSUPPORTED_ERROR ) { 2688 errln("FAIL: getInstance(en_US@numbers=foobar) should have returned U_UNSUPPORTED_ERROR"); 2689 } 2690 2691 NumberingSystem *ns = NumberingSystem::createInstance(ec); 2692 if (U_FAILURE(ec)) { 2693 dataerrln("FAIL: NumberingSystem::createInstance(ec); - %s", u_errorName(ec)); 2694 } 2695 2696 ns->getDynamicClassID(); 2697 2698 ns->getStaticClassID(); 2699 2700 NumberingSystem *ns1 = new NumberingSystem(*ns); 2701 if (ns1 == NULL) { 2702 errln("FAIL: NumberSystem copy constructor returned NULL."); 2703 } 2704 2705 delete ns1; 2706 delete ns; 2707 delete fmt1; 2708 delete fmt2; 2709 delete fmt3; 2710 delete fmt4; 2711 } 2712 2713 2714 void 2715 NumberFormatTest::TestMultiCurrencySign() { 2716 const char* DATA[][6] = { 2717 // the fields in the following test are: 2718 // locale, 2719 // currency pattern (with negative pattern), 2720 // currency number to be formatted, 2721 // currency format using currency symbol name, such as "$" for USD, 2722 // currency format using currency ISO name, such as "USD", 2723 // currency format using plural name, such as "US dollars". 2724 // for US locale 2725 {"en_US", "\\u00A4#,##0.00;-\\u00A4#,##0.00", "1234.56", "$1,234.56", "USD1,234.56", "US dollars1,234.56"}, 2726 {"en_US", "\\u00A4#,##0.00;-\\u00A4#,##0.00", "-1234.56", "-$1,234.56", "-USD1,234.56", "-US dollars1,234.56"}, 2727 {"en_US", "\\u00A4#,##0.00;-\\u00A4#,##0.00", "1", "$1.00", "USD1.00", "US dollar1.00"}, 2728 // for CHINA locale 2729 {"zh_CN", "\\u00A4#,##0.00;(\\u00A4#,##0.00)", "1234.56", "\\uFFE51,234.56", "CNY1,234.56", "\\u4EBA\\u6C11\\u5E011,234.56"}, 2730 {"zh_CN", "\\u00A4#,##0.00;(\\u00A4#,##0.00)", "-1234.56", "(\\uFFE51,234.56)", "(CNY1,234.56)", "(\\u4EBA\\u6C11\\u5E011,234.56)"}, 2731 {"zh_CN", "\\u00A4#,##0.00;(\\u00A4#,##0.00)", "1", "\\uFFE51.00", "CNY1.00", "\\u4EBA\\u6C11\\u5E011.00"} 2732 }; 2733 2734 const UChar doubleCurrencySign[] = {0xA4, 0xA4, 0}; 2735 UnicodeString doubleCurrencyStr(doubleCurrencySign); 2736 const UChar tripleCurrencySign[] = {0xA4, 0xA4, 0xA4, 0}; 2737 UnicodeString tripleCurrencyStr(tripleCurrencySign); 2738 2739 for (uint32_t i=0; i<sizeof(DATA)/sizeof(DATA[0]); ++i) { 2740 const char* locale = DATA[i][0]; 2741 UnicodeString pat = ctou(DATA[i][1]); 2742 double numberToBeFormat = atof(DATA[i][2]); 2743 UErrorCode status = U_ZERO_ERROR; 2744 DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale(locale), status); 2745 if (U_FAILURE(status)) { 2746 delete sym; 2747 continue; 2748 } 2749 for (int j=1; j<=3; ++j) { 2750 // j represents the number of currency sign in the pattern. 2751 if (j == 2) { 2752 pat = pat.findAndReplace(ctou("\\u00A4"), doubleCurrencyStr); 2753 } else if (j == 3) { 2754 pat = pat.findAndReplace(ctou("\\u00A4\\u00A4"), tripleCurrencyStr); 2755 } 2756 2757 DecimalFormat* fmt = new DecimalFormat(pat, new DecimalFormatSymbols(*sym), status); 2758 if (U_FAILURE(status)) { 2759 errln("FAILED init DecimalFormat "); 2760 delete fmt; 2761 continue; 2762 } 2763 UnicodeString s; 2764 ((NumberFormat*) fmt)->format(numberToBeFormat, s); 2765 // DATA[i][3] is the currency format result using a 2766 // single currency sign. 2767 // DATA[i][4] is the currency format result using 2768 // double currency sign. 2769 // DATA[i][5] is the currency format result using 2770 // triple currency sign. 2771 // DATA[i][j+2] is the currency format result using 2772 // 'j' number of currency sign. 2773 UnicodeString currencyFormatResult = ctou(DATA[i][2+j]); 2774 if (s.compare(currencyFormatResult)) { 2775 errln("FAIL format: Expected " + currencyFormatResult + "; Got " + s); 2776 } 2777 // mix style parsing 2778 for (int k=3; k<=5; ++k) { 2779 // DATA[i][3] is the currency format result using a 2780 // single currency sign. 2781 // DATA[i][4] is the currency format result using 2782 // double currency sign. 2783 // DATA[i][5] is the currency format result using 2784 // triple currency sign. 2785 UnicodeString oneCurrencyFormat = ctou(DATA[i][k]); 2786 UErrorCode status = U_ZERO_ERROR; 2787 Formattable parseRes; 2788 fmt->parse(oneCurrencyFormat, parseRes, status); 2789 if (U_FAILURE(status) || 2790 (parseRes.getType() == Formattable::kDouble && 2791 parseRes.getDouble() != numberToBeFormat) || 2792 (parseRes.getType() == Formattable::kLong && 2793 parseRes.getLong() != numberToBeFormat)) { 2794 errln("FAILED parse " + oneCurrencyFormat + "; (i, j, k): " + 2795 i + ", " + j + ", " + k); 2796 } 2797 } 2798 delete fmt; 2799 } 2800 delete sym; 2801 } 2802 } 2803 2804 2805 void 2806 NumberFormatTest::TestCurrencyFormatForMixParsing() { 2807 UErrorCode status = U_ZERO_ERROR; 2808 MeasureFormat* curFmt = MeasureFormat::createCurrencyFormat(Locale("en_US"), status); 2809 if (U_FAILURE(status)) { 2810 delete curFmt; 2811 return; 2812 } 2813 const char* formats[] = { 2814 "$1,234.56", // string to be parsed 2815 "USD1,234.56", 2816 "US dollars1,234.56", 2817 "1,234.56 US dollars" 2818 }; 2819 for (uint32_t i = 0; i < sizeof(formats)/sizeof(formats[0]); ++i) { 2820 UnicodeString stringToBeParsed = ctou(formats[i]); 2821 Formattable result; 2822 UErrorCode status = U_ZERO_ERROR; 2823 curFmt->parseObject(stringToBeParsed, result, status); 2824 if (U_FAILURE(status)) { 2825 errln("FAIL: measure format parsing: '%s' ec: %s", formats[i], u_errorName(status)); 2826 } else if (result.getType() != Formattable::kObject || 2827 result.getObject()->getDynamicClassID() != CurrencyAmount::getStaticClassID() || 2828 ((CurrencyAmount*)result.getObject())->getNumber().getDouble() != 1234.56 || 2829 UnicodeString(((CurrencyAmount*)result.getObject())->getISOCurrency()).compare(ISO_CURRENCY_USD)) { 2830 errln("FAIL: getCurrencyFormat of default locale (en_US) failed roundtripping the number "); 2831 if (((CurrencyAmount*)result.getObject())->getNumber().getDouble() != 1234.56) { 2832 errln((UnicodeString)"wong number, expect: 1234.56" + ", got: " + ((CurrencyAmount*)result.getObject())->getNumber().getDouble()); 2833 } 2834 if (((CurrencyAmount*)result.getObject())->getISOCurrency() != ISO_CURRENCY_USD) { 2835 errln((UnicodeString)"wong currency, expect: USD" + ", got: " + ((CurrencyAmount*)result.getObject())->getISOCurrency()); 2836 } 2837 } 2838 } 2839 delete curFmt; 2840 } 2841 2842 2843 void 2844 NumberFormatTest::TestDecimalFormatCurrencyParse() { 2845 // Locale.US 2846 UErrorCode status = U_ZERO_ERROR; 2847 DecimalFormatSymbols* sym = new DecimalFormatSymbols(Locale("en_US"), status); 2848 if (U_FAILURE(status)) { 2849 delete sym; 2850 return; 2851 } 2852 UnicodeString pat; 2853 UChar currency = 0x00A4; 2854 // "\xA4#,##0.00;-\xA4#,##0.00" 2855 pat.append(currency).append(currency).append(currency).append("#,##0.00;-").append(currency).append(currency).append(currency).append("#,##0.00"); 2856 DecimalFormat* fmt = new DecimalFormat(pat, sym, status); 2857 if (U_FAILURE(status)) { 2858 delete fmt; 2859 errln("failed to new DecimalFormat in TestDecimalFormatCurrencyParse"); 2860 return; 2861 } 2862 const char* DATA[][2] = { 2863 // the data are: 2864 // string to be parsed, the parsed result (number) 2865 {"$1.00", "1"}, 2866 {"USD1.00", "1"}, 2867 {"1.00 US dollar", "1"}, 2868 {"$1,234.56", "1234.56"}, 2869 {"USD1,234.56", "1234.56"}, 2870 {"1,234.56 US dollar", "1234.56"}, 2871 }; 2872 for (uint32_t i = 0; i < sizeof(DATA)/sizeof(DATA[0]); ++i) { 2873 UnicodeString stringToBeParsed = ctou(DATA[i][0]); 2874 double parsedResult = atof(DATA[i][1]); 2875 UErrorCode status = U_ZERO_ERROR; 2876 Formattable result; 2877 fmt->parse(stringToBeParsed, result, status); 2878 if (U_FAILURE(status) || 2879 (result.getType() == Formattable::kDouble && 2880 result.getDouble() != parsedResult) || 2881 (result.getType() == Formattable::kLong && 2882 result.getLong() != parsedResult)) { 2883 errln((UnicodeString)"FAIL parse: Expected " + parsedResult); 2884 } 2885 } 2886 delete fmt; 2887 } 2888 2889 2890 void 2891 NumberFormatTest::TestCurrencyIsoPluralFormat() { 2892 const char* DATA[][6] = { 2893 // the data are: 2894 // locale, 2895 // currency amount to be formatted, 2896 // currency ISO code to be formatted, 2897 // format result using CURRENCYSTYLE, 2898 // format result using ISOCURRENCYSTYLE, 2899 // format result using PLURALCURRENCYSTYLE, 2900 2901 {"en_US", "1", "USD", "$1.00", "USD1.00", "1.00 US dollar"}, 2902 {"en_US", "1234.56", "USD", "$1,234.56", "USD1,234.56", "1,234.56 US dollars"}, 2903 {"en_US", "-1234.56", "USD", "($1,234.56)", "(USD1,234.56)", "-1,234.56 US dollars"}, 2904 {"zh_CN", "1", "USD", "US$1.00", "USD1.00", "1.00 \\u7F8E\\u5143"}, 2905 {"zh_CN", "1234.56", "USD", "US$1,234.56", "USD1,234.56", "1,234.56 \\u7F8E\\u5143"}, 2906 // wrong ISO code {"zh_CN", "1", "CHY", "CHY1.00", "CHY1.00", "1.00 CHY"}, 2907 // wrong ISO code {"zh_CN", "1234.56", "CHY", "CHY1,234.56", "CHY1,234.56", "1,234.56 CHY"}, 2908 {"zh_CN", "1", "CNY", "\\uFFE51.00", "CNY1.00", "1.00 \\u4EBA\\u6C11\\u5E01"}, 2909 {"zh_CN", "1234.56", "CNY", "\\uFFE51,234.56", "CNY1,234.56", "1,234.56 \\u4EBA\\u6C11\\u5E01"}, 2910 {"ru_RU", "1", "RUB", "1,00\\u00A0\\u0440\\u0443\\u0431.", "1,00\\u00A0RUB", "1,00 \\u0420\\u043E\\u0441\\u0441\\u0438\\u0439\\u0441\\u043A\\u0438\\u0439 \\u0440\\u0443\\u0431\\u043B\\u044C"}, 2911 {"ru_RU", "2", "RUB", "2,00\\u00A0\\u0440\\u0443\\u0431.", "2,00\\u00A0RUB", "2,00 \\u0420\\u043E\\u0441\\u0441\\u0438\\u0439\\u0441\\u043A\\u0438\\u0445 \\u0440\\u0443\\u0431\\u043B\\u044F"}, 2912 {"ru_RU", "5", "RUB", "5,00\\u00A0\\u0440\\u0443\\u0431.", "5,00\\u00A0RUB", "5,00 \\u0420\\u043E\\u0441\\u0441\\u0438\\u0439\\u0441\\u043A\\u0438\\u0445 \\u0440\\u0443\\u0431\\u043B\\u0435\\u0439"}, 2913 // test locale without currency information 2914 {"root", "-1.23", "USD", "-US$\\u00A01.23", "-USD\\u00A01.23", "-1.23 USD"}, 2915 // test choice format 2916 {"es_AR", "1", "INR", "Rs\\u00A01,00", "INR\\u00A01,00", "1,00 rupia india"}, 2917 }; 2918 2919 for (uint32_t i=0; i<sizeof(DATA)/sizeof(DATA[0]); ++i) { 2920 for (NumberFormat::EStyles k = NumberFormat::kCurrencyStyle; 2921 k <= NumberFormat::kPluralCurrencyStyle; 2922 k = (NumberFormat::EStyles)(k+1)) { 2923 // k represents currency format style. 2924 if ( k != NumberFormat::kCurrencyStyle && 2925 k != NumberFormat::kIsoCurrencyStyle && 2926 k != NumberFormat::kPluralCurrencyStyle ) { 2927 continue; 2928 } 2929 const char* localeString = DATA[i][0]; 2930 double numberToBeFormat = atof(DATA[i][1]); 2931 const char* currencyISOCode = DATA[i][2]; 2932 Locale locale(localeString); 2933 UErrorCode status = U_ZERO_ERROR; 2934 NumberFormat* numFmt = NumberFormat::createInstance(locale, k, status); 2935 if (U_FAILURE(status)) { 2936 delete numFmt; 2937 dataerrln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k + " - " + u_errorName(status)); 2938 continue; 2939 } 2940 // TODO: need to be UChar* 2941 UChar currencyCode[4]; 2942 currencyCode[0] = currencyISOCode[0]; 2943 currencyCode[1] = currencyISOCode[1]; 2944 currencyCode[2] = currencyISOCode[2]; 2945 currencyCode[3] = currencyISOCode[3]; 2946 numFmt->setCurrency(currencyCode, status); 2947 if (U_FAILURE(status)) { 2948 delete numFmt; 2949 errln((UnicodeString)"can not set currency:" + currencyISOCode); 2950 continue; 2951 } 2952 2953 UnicodeString strBuf; 2954 numFmt->format(numberToBeFormat, strBuf); 2955 int resultDataIndex = k; 2956 if ( k == NumberFormat::kCurrencyStyle ) { 2957 resultDataIndex = k+2; 2958 } 2959 // DATA[i][resultDataIndex] is the currency format result 2960 // using 'k' currency style. 2961 UnicodeString formatResult = ctou(DATA[i][resultDataIndex]); 2962 if (strBuf.compare(formatResult)) { 2963 errln("FAIL: Expected " + formatResult + " actual: " + strBuf); 2964 } 2965 // test parsing, and test parsing for all currency formats. 2966 for (int j = 3; j < 6; ++j) { 2967 // DATA[i][3] is the currency format result using 2968 // CURRENCYSTYLE formatter. 2969 // DATA[i][4] is the currency format result using 2970 // ISOCURRENCYSTYLE formatter. 2971 // DATA[i][5] is the currency format result using 2972 // PLURALCURRENCYSTYLE formatter. 2973 UnicodeString oneCurrencyFormatResult = ctou(DATA[i][j]); 2974 UErrorCode status = U_ZERO_ERROR; 2975 Formattable parseResult; 2976 numFmt->parse(oneCurrencyFormatResult, parseResult, status); 2977 if (U_FAILURE(status) || 2978 (parseResult.getType() == Formattable::kDouble && 2979 parseResult.getDouble() != numberToBeFormat) || 2980 (parseResult.getType() == Formattable::kLong && 2981 parseResult.getLong() != numberToBeFormat)) { 2982 errln((UnicodeString)"FAIL: getCurrencyFormat of locale " + 2983 localeString + " failed roundtripping the number"); 2984 if (parseResult.getType() == Formattable::kDouble) { 2985 errln((UnicodeString)"expected: " + numberToBeFormat + "; actual: " +parseResult.getDouble()); 2986 } else { 2987 errln((UnicodeString)"expected: " + numberToBeFormat + "; actual: " +parseResult.getLong()); 2988 } 2989 } 2990 } 2991 delete numFmt; 2992 } 2993 } 2994 } 2995 2996 void 2997 NumberFormatTest::TestCurrencyParsing() { 2998 const char* DATA[][6] = { 2999 // the data are: 3000 // locale, 3001 // currency amount to be formatted, 3002 // currency ISO code to be formatted, 3003 // format result using CURRENCYSTYLE, 3004 // format result using ISOCURRENCYSTYLE, 3005 // format result using PLURALCURRENCYSTYLE, 3006 {"en_US", "1", "USD", "$1.00", "USD1.00", "1.00 US dollar"}, 3007 {"pa_PK", "1", "USD", "US$\\u00a0\\u0a67.\\u0a66\\u0a66", "USD\\u00a0\\u0a67.\\u0a66\\u0a66", "\\u0a67.\\u0a66\\u0a66 USD"}, 3008 {"es_AR", "1", "USD", "US$\\u00a01,00", "USD\\u00a01,00", "1,00 d\\u00f3lar estadounidense"}, 3009 {"ar_EG", "1", "USD", "US$\\u00a0\\u0661\\u066b\\u0660\\u0660", "USD\\u00a0\\u0661\\u066b\\u0660\\u0660", "\\u0661\\u066b\\u0660\\u0660 \\u062f\\u0648\\u0644\\u0627\\u0631 \\u0623\\u0645\\u0631\\u064a\\u0643\\u064a"}, 3010 {"fa_CA", "1", "USD", "\\u06f1\\u066b\\u06f0\\u06f0\\u00a0US$", "\\u06f1\\u066b\\u06f0\\u06f0\\u00a0USD", "\\u06f1\\u066b\\u06f0\\u06f0\\u0020\\u062f\\u0644\\u0627\\u0631\\u0020\\u0627\\u0645\\u0631\\u06cc\\u06a9\\u0627"}, 3011 {"he_IL", "1", "USD", "1.00\\u00a0US$", "1.00\\u00a0USD", "1.00 \\u05d3\\u05d5\\u05dc\\u05e8 \\u05d0\\u05de\\u05e8\\u05d9\\u05e7\\u05d0\\u05d9"}, 3012 {"hr_HR", "1", "USD", "1,00\\u00a0$", "1,00\\u00a0USD", "1,00 Ameri\\u010dki dolar"}, 3013 {"id_ID", "1", "USD", "US$1,00", "USD1,00", "1,00 USD"}, 3014 {"it_IT", "1", "USD", "US$\\u00a01,00", "USD\\u00a01,00", "1,00 Dollaro Statunitense"}, 3015 {"ko_KR", "1", "USD", "US$1.00", "USD1.00", "1.00 \\ubbf8\\uad6d \\ub2ec\\ub7ec"}, 3016 {"ja_JP", "1", "USD", "$1.00", "USD1.00", "1.00 \\u7c73\\u30c9\\u30eb"}, 3017 {"zh_CN", "1", "CNY", "\\uFFE51.00", "CNY1.00", "1.00 \\u4EBA\\u6C11\\u5E01"}, 3018 {"zh_TW", "1", "CNY", "\\uFFE51.00", "CNY1.00", "1.00 \\u4eba\\u6c11\\u5e63"}, 3019 {"ru_RU", "1", "RUB", "1,00\\u00A0\\u0440\\u0443\\u0431.", "1,00\\u00A0RUB", "1,00 \\u0420\\u043E\\u0441\\u0441\\u0438\\u0439\\u0441\\u043A\\u0438\\u0439 \\u0440\\u0443\\u0431\\u043B\\u044C"}, 3020 }; 3021 3022 #ifdef NUMFMTST_CACHE_DEBUG 3023 int deadloop = 0; 3024 for (;;) { 3025 printf("loop: %d\n", deadloop++); 3026 #endif 3027 for (uint32_t i=0; i<sizeof(DATA)/sizeof(DATA[0]); ++i) { 3028 for (NumberFormat::EStyles k = NumberFormat::kCurrencyStyle; 3029 k <= NumberFormat::kPluralCurrencyStyle; 3030 k = (NumberFormat::EStyles)(k+1)) { 3031 // k represents currency format style. 3032 if ( k != NumberFormat::kCurrencyStyle && 3033 k != NumberFormat::kIsoCurrencyStyle && 3034 k != NumberFormat::kPluralCurrencyStyle ) { 3035 continue; 3036 } 3037 const char* localeString = DATA[i][0]; 3038 double numberToBeFormat = atof(DATA[i][1]); 3039 const char* currencyISOCode = DATA[i][2]; 3040 Locale locale(localeString); 3041 UErrorCode status = U_ZERO_ERROR; 3042 NumberFormat* numFmt = NumberFormat::createInstance(locale, k, status); 3043 if (U_FAILURE(status)) { 3044 delete numFmt; 3045 dataerrln((UnicodeString)"can not create instance, locale:" + localeString + ", style: " + k + " - " + u_errorName(status)); 3046 continue; 3047 } 3048 // TODO: need to be UChar* 3049 UChar currencyCode[4]; 3050 currencyCode[0] = currencyISOCode[0]; 3051 currencyCode[1] = currencyISOCode[1]; 3052 currencyCode[2] = currencyISOCode[2]; 3053 currencyCode[3] = currencyISOCode[3]; 3054 numFmt->setCurrency(currencyCode, status); 3055 if (U_FAILURE(status)) { 3056 delete numFmt; 3057 errln((UnicodeString)"can not set currency:" + currencyISOCode); 3058 continue; 3059 } 3060 3061 /* 3062 UnicodeString strBuf; 3063 numFmt->format(numberToBeFormat, strBuf); 3064 int resultDataIndex = k; 3065 if ( k == NumberFormat::kCurrencyStyle ) { 3066 resultDataIndex = k+2; 3067 } 3068 // DATA[i][resultDataIndex] is the currency format result 3069 // using 'k' currency style. 3070 UnicodeString formatResult = ctou(DATA[i][resultDataIndex]); 3071 if (strBuf.compare(formatResult)) { 3072 errln("FAIL: Expected " + formatResult + " actual: " + strBuf); 3073 } 3074 */ 3075 // test parsing, and test parsing for all currency formats. 3076 for (int j = 3; j < 6; ++j) { 3077 // DATA[i][3] is the currency format result using 3078 // CURRENCYSTYLE formatter. 3079 // DATA[i][4] is the currency format result using 3080 // ISOCURRENCYSTYLE formatter. 3081 // DATA[i][5] is the currency format result using 3082 // PLURALCURRENCYSTYLE formatter. 3083 UnicodeString oneCurrencyFormatResult = ctou(DATA[i][j]); 3084 UErrorCode status = U_ZERO_ERROR; 3085 Formattable parseResult; 3086 numFmt->parse(oneCurrencyFormatResult, parseResult, status); 3087 if (U_FAILURE(status) || 3088 (parseResult.getType() == Formattable::kDouble && 3089 parseResult.getDouble() != numberToBeFormat) || 3090 (parseResult.getType() == Formattable::kLong && 3091 parseResult.getLong() != numberToBeFormat)) { 3092 errln((UnicodeString)"FAIL: getCurrencyFormat of locale " + 3093 localeString + " failed roundtripping the number" + 3094 "(i,k,j): " + i + ", " + k + ", " + j); 3095 if (parseResult.getType() == Formattable::kDouble) { 3096 errln((UnicodeString)"expected: " + numberToBeFormat + "; actual: " +parseResult.getDouble()); 3097 } else { 3098 errln((UnicodeString)"expected: " + numberToBeFormat + "; actual: " +parseResult.getLong()); 3099 } 3100 } 3101 } 3102 delete numFmt; 3103 } 3104 } 3105 #ifdef NUMFMTST_CACHE_DEBUG 3106 } 3107 #endif 3108 } 3109 3110 3111 void 3112 NumberFormatTest::TestParseCurrencyInUCurr() { 3113 const char* DATA[] = { 3114 "1.00 US DOLLAR", // case in-sensitive 3115 "$1.00", 3116 "USD1.00", 3117 "US dollar1.00", 3118 "US dollars1.00", 3119 "$1.00", 3120 "AU$1.00", 3121 "ADP1.00", 3122 "ADP1.00", 3123 "AED1.00", 3124 "AED1.00", 3125 "AFA1.00", 3126 "AFA1.00", 3127 "AFN1.00", 3128 "ALL1.00", 3129 "AMD1.00", 3130 "ANG1.00", 3131 "AOA1.00", 3132 "AOK1.00", 3133 "AOK1.00", 3134 "AON1.00", 3135 "AON1.00", 3136 "AOR1.00", 3137 "AOR1.00", 3138 "AR$1.00", 3139 "ARA1.00", 3140 "ARA1.00", 3141 "ARP1.00", 3142 "ARP1.00", 3143 "ARS1.00", 3144 "ATS1.00", 3145 "ATS1.00", 3146 "AUD1.00", 3147 "AWG1.00", 3148 "AZM1.00", 3149 "AZM1.00", 3150 "AZN1.00", 3151 "Af1.00", 3152 "Afghan Afghani (1927-2002)1.00", 3153 "Afghan Afghani (AFA)1.00", 3154 "Afghan Afghani1.00", 3155 "Afghan Afghani1.00", 3156 "Afghan Afghanis (AFA)1.00", 3157 "Afghan Afghanis1.00", 3158 "Afl.1.00", 3159 "Albanian Lek1.00", 3160 "Albanian lek1.00", 3161 "Albanian lek\\u00eb1.00", 3162 "Algerian Dinar1.00", 3163 "Algerian dinar1.00", 3164 "Algerian dinars1.00", 3165 "Andorran Peseta1.00", 3166 "Andorran peseta1.00", 3167 "Andorran pesetas1.00", 3168 "Angolan Kwanza (1977-1990)1.00", 3169 "Angolan Kwanza Reajustado (1995-1999)1.00", 3170 "Angolan Kwanza1.00", 3171 "Angolan New Kwanza (1990-2000)1.00", 3172 "Angolan kwanza (AOK)1.00", 3173 "Angolan kwanza reajustado (AOR)1.00", 3174 "Angolan kwanza1.00", 3175 "Angolan kwanzas (AOK)1.00", 3176 "Angolan kwanzas reajustado (AOR)1.00", 3177 "Angolan kwanzas1.00", 3178 "Angolan new kwanza (AON)1.00", 3179 "Angolan new kwanzas (AON)1.00", 3180 "Argentine Austral1.00", 3181 "Argentine Peso (1983-1985)1.00", 3182 "Argentine Peso1.00", 3183 "Argentine austral1.00", 3184 "Argentine australs1.00", 3185 "Argentine peso (ARP)1.00", 3186 "Argentine peso1.00", 3187 "Argentine pesos (ARP)1.00", 3188 "Argentine pesos1.00", 3189 "Armenian Dram1.00", 3190 "Armenian dram1.00", 3191 "Armenian drams1.00", 3192 "Aruban Florin1.00", 3193 "Aruban florin1.00", 3194 "Australian Dollar1.00", 3195 "Australian dollar1.00", 3196 "Australian dollars1.00", 3197 "Austrian Schilling1.00", 3198 "Austrian schilling1.00", 3199 "Austrian schillings1.00", 3200 "Azerbaijani Manat (1993-2006)1.00", 3201 "Azerbaijani Manat1.00", 3202 "Azerbaijani manat (AZM)1.00", 3203 "Azerbaijani manat1.00", 3204 "Azerbaijani manats (AZM)1.00", 3205 "Azerbaijani manats1.00", 3206 "BN$1.00", 3207 "BAD1.00", 3208 "BAD1.00", 3209 "BAM1.00", 3210 "BBD1.00", 3211 "BD$1.00", 3212 "BDT1.00", 3213 "BEC1.00", 3214 "BEC1.00", 3215 "BEF1.00", 3216 "BEL1.00", 3217 "BEL1.00", 3218 "BF1.00", 3219 "BGL1.00", 3220 "BGN1.00", 3221 "BGN1.00", 3222 "BHD1.00", 3223 "BIF1.00", 3224 "BMD1.00", 3225 "BND1.00", 3226 "BOB1.00", 3227 "BOP1.00", 3228 "BOP1.00", 3229 "BOV1.00", 3230 "BOV1.00", 3231 "BRB1.00", 3232 "BRB1.00", 3233 "BRC1.00", 3234 "BRC1.00", 3235 "BRE1.00", 3236 "BRE1.00", 3237 "BRL1.00", 3238 "BRN1.00", 3239 "BRN1.00", 3240 "BRR1.00", 3241 "BRR1.00", 3242 "BSD1.00", 3243 "BSD1.00", 3244 "BTN1.00", 3245 "BUK1.00", 3246 "BUK1.00", 3247 "BWP1.00", 3248 "BYB1.00", 3249 "BYB1.00", 3250 "BYR1.00", 3251 "BZ$1.00", 3252 "BZD1.00", 3253 "Bahamian Dollar1.00", 3254 "Bahamian dollar1.00", 3255 "Bahamian dollars1.00", 3256 "Bahraini Dinar1.00", 3257 "Bahraini dinar1.00", 3258 "Bahraini dinars1.00", 3259 "Bangladeshi Taka1.00", 3260 "Bangladeshi taka1.00", 3261 "Bangladeshi takas1.00", 3262 "Barbadian Dollar1.00", 3263 "Barbadian dollar1.00", 3264 "Barbadian dollars1.00", 3265 "Bds$1.00", 3266 "Belarusian New Ruble (1994-1999)1.00", 3267 "Belarusian Ruble1.00", 3268 "Belarusian new ruble (BYB)1.00", 3269 "Belarusian new rubles (BYB)1.00", 3270 "Belarusian ruble1.00", 3271 "Belarusian rubles1.00", 3272 "Belgian Franc (convertible)1.00", 3273 "Belgian Franc (financial)1.00", 3274 "Belgian Franc1.00", 3275 "Belgian franc (convertible)1.00", 3276 "Belgian franc (financial)1.00", 3277 "Belgian franc1.00", 3278 "Belgian francs (convertible)1.00", 3279 "Belgian francs (financial)1.00", 3280 "Belgian francs1.00", 3281 "Belize Dollar1.00", 3282 "Belize dollar1.00", 3283 "Belize dollars1.00", 3284 "Bermudan Dollar1.00", 3285 "Bermudan dollar1.00", 3286 "Bermudan dollars1.00", 3287 "Bhutanese Ngultrum1.00", 3288 "Bhutanese ngultrum1.00", 3289 "Bhutanese ngultrums1.00", 3290 "Bolivian Mvdol1.00", 3291 "Bolivian Peso1.00", 3292 "Bolivian mvdol1.00", 3293 "Bolivian mvdols1.00", 3294 "Bolivian peso1.00", 3295 "Bolivian pesos1.00", 3296 "Bolivian Boliviano1.00", 3297 "Bolivian Boliviano1.00", 3298 "Bolivian Bolivianos1.00", 3299 "Bosnia-Herzegovina Convertible Mark1.00", 3300 "Bosnia-Herzegovina Dinar1.00", 3301 "Bosnia-Herzegovina convertible mark1.00", 3302 "Bosnia-Herzegovina convertible marks1.00", 3303 "Bosnia-Herzegovina dinar1.00", 3304 "Bosnia-Herzegovina dinars1.00", 3305 "Botswanan Pula1.00", 3306 "Botswanan pula1.00", 3307 "Botswanan pulas1.00", 3308 "Br1.00", 3309 "Brazilian Cruzado Novo1.00", 3310 "Brazilian Cruzado1.00", 3311 "Brazilian Cruzeiro (1990-1993)1.00", 3312 "Brazilian Cruzeiro Novo (1967-1986)1.00", 3313 "Brazilian Cruzeiro1.00", 3314 "Brazilian Real1.00", 3315 "Brazilian cruzado novo1.00", 3316 "Brazilian cruzado novos1.00", 3317 "Brazilian cruzado1.00", 3318 "Brazilian cruzados1.00", 3319 "Brazilian cruzeiro (BRE)1.00", 3320 "Brazilian cruzeiro novo (BRB)1.00", 3321 "Brazilian cruzeiro1.00", 3322 "Brazilian cruzeiros (BRE)1.00", 3323 "Brazilian cruzeiros novo (BRB)1.00", 3324 "Brazilian cruzeiros1.00", 3325 "Brazilian real1.00", 3326 "Brazilian reals1.00", 3327 "British Pound Sterling1.00", 3328 "British pound sterling1.00", 3329 "British pounds sterling1.00", 3330 "Brunei Dollar1.00", 3331 "Brunei dollar1.00", 3332 "Brunei dollars1.00", 3333 "Bs1.00", 3334 "Bs.F.1.00", 3335 "Bulgarian Hard Lev1.00", 3336 "Bulgarian Lev1.00", 3337 "Bulgarian Leva1.00", 3338 "Bulgarian hard lev1.00", 3339 "Bulgarian hard leva1.00", 3340 "Bulgarian lev1.00", 3341 "Burmese Kyat1.00", 3342 "Burmese kyat1.00", 3343 "Burmese kyats1.00", 3344 "Burundian Franc1.00", 3345 "Burundian franc1.00", 3346 "Burundian francs1.00", 3347 "C$1.00", 3348 "CA$1.00", 3349 "CAD1.00", 3350 "CDF1.00", 3351 "CDF1.00", 3352 "CF1.00", 3353 "CFA Franc BCEAO1.00", 3354 "CFA Franc BEAC1.00", 3355 "CFA franc BCEAO1.00", 3356 "CFA franc BEAC1.00", 3357 "CFA francs BCEAO1.00", 3358 "CFA francs BEAC1.00", 3359 "CFP Franc1.00", 3360 "CFP franc1.00", 3361 "CFP francs1.00", 3362 "CFPF1.00", 3363 "CHE1.00", 3364 "CHE1.00", 3365 "CHF1.00", 3366 "CHW1.00", 3367 "CHW1.00", 3368 "CL$1.00", 3369 "CLF1.00", 3370 "CLF1.00", 3371 "CLP1.00", 3372 "CNY1.00", 3373 "CO$1.00", 3374 "COP1.00", 3375 "COU1.00", 3376 "COU1.00", 3377 "CRC1.00", 3378 "CSD1.00", 3379 "CSD1.00", 3380 "CSK1.00", 3381 "CSK1.00", 3382 "CUP1.00", 3383 "CUP1.00", 3384 "CVE1.00", 3385 "CYP1.00", 3386 "CZK1.00", 3387 "Cambodian Riel1.00", 3388 "Cambodian riel1.00", 3389 "Cambodian riels1.00", 3390 "Canadian Dollar1.00", 3391 "Canadian dollar1.00", 3392 "Canadian dollars1.00", 3393 "Cape Verdean Escudo1.00", 3394 "Cape Verdean escudo1.00", 3395 "Cape Verdean escudos1.00", 3396 "Cayman Islands Dollar1.00", 3397 "Cayman Islands dollar1.00", 3398 "Cayman Islands dollars1.00", 3399 "Chilean Peso1.00", 3400 "Chilean Unidades de Fomento1.00", 3401 "Chilean peso1.00", 3402 "Chilean pesos1.00", 3403 "Chilean unidades de fomento1.00", 3404 "Chilean unidades de fomentos1.00", 3405 "Chinese Yuan Renminbi1.00", 3406 "Chinese yuan1.00", 3407 "Colombian Peso1.00", 3408 "Colombian peso1.00", 3409 "Colombian pesos1.00", 3410 "Comorian Franc1.00", 3411 "Comorian franc1.00", 3412 "Comorian francs1.00", 3413 "Congolese Franc1.00", 3414 "Congolese franc1.00", 3415 "Congolese francs1.00", 3416 "Costa Rican Col\\u00f3n1.00", 3417 "Costa Rican col\\u00f3n1.00", 3418 "Costa Rican col\\u00f3ns1.00", 3419 "Croatian Dinar1.00", 3420 "Croatian Kuna1.00", 3421 "Croatian dinar1.00", 3422 "Croatian dinars1.00", 3423 "Croatian kuna1.00", 3424 "Croatian kunas1.00", 3425 "Cuban Peso1.00", 3426 "Cuban peso1.00", 3427 "Cuban pesos1.00", 3428 "Cypriot Pound1.00", 3429 "Cypriot pound1.00", 3430 "Cypriot pounds1.00", 3431 "Czech Republic Koruna1.00", 3432 "Czech Republic koruna1.00", 3433 "Czech Republic korunas1.00", 3434 "Czechoslovak Hard Koruna1.00", 3435 "Czechoslovak hard koruna1.00", 3436 "Czechoslovak hard korunas1.00", 3437 "DA1.00", 3438 "DDM1.00", 3439 "DDM1.00", 3440 "DEM1.00", 3441 "DEM1.00", 3442 "DJF1.00", 3443 "DKK1.00", 3444 "DOP1.00", 3445 "DZD1.00", 3446 "Danish Krone1.00", 3447 "Danish krone1.00", 3448 "Danish kroner1.00", 3449 "Db1.00", 3450 "German Mark1.00", 3451 "German mark1.00", 3452 "German marks1.00", 3453 "Djiboutian Franc1.00", 3454 "Djiboutian franc1.00", 3455 "Djiboutian francs1.00", 3456 "Dkr1.00", 3457 "Dominican Peso1.00", 3458 "Dominican peso1.00", 3459 "Dominican pesos1.00", 3460 "EC$1.00", 3461 "ECS1.00", 3462 "ECS1.00", 3463 "ECV1.00", 3464 "ECV1.00", 3465 "EEK1.00", 3466 "EEK1.00", 3467 "EGP1.00", 3468 "EGP1.00", 3469 "ERN1.00", 3470 "ERN1.00", 3471 "ESA1.00", 3472 "ESA1.00", 3473 "ESB1.00", 3474 "ESB1.00", 3475 "ESP1.00", 3476 "ETB1.00", 3477 "EUR1.00", 3478 "East Caribbean Dollar1.00", 3479 "East Caribbean dollar1.00", 3480 "East Caribbean dollars1.00", 3481 "East German Mark1.00", 3482 "East German mark1.00", 3483 "East German marks1.00", 3484 "Ecuadorian Sucre1.00", 3485 "Ecuadorian Unidad de Valor Constante (UVC)1.00", 3486 "Ecuadorian sucre1.00", 3487 "Ecuadorian sucres1.00", 3488 "Ecuadorian unidad de valor Constante (UVC)1.00", 3489 "Ecuadorian unidads de valor Constante (UVC)1.00", 3490 "Egyptian Pound1.00", 3491 "Egyptian pound1.00", 3492 "Egyptian pounds1.00", 3493 "Salvadoran Col\\u00f3n1.00", 3494 "Salvadoran col\\u00f3n1.00", 3495 "Salvadoran colones1.00", 3496 "Equatorial Guinean Ekwele1.00", 3497 "Equatorial Guinean ekwele1.00", 3498 "Eritrean Nakfa1.00", 3499 "Eritrean nakfa1.00", 3500 "Eritrean nakfas1.00", 3501 "Esc1.00", 3502 "Estonian Kroon1.00", 3503 "Estonian kroon1.00", 3504 "Estonian kroons1.00", 3505 "Ethiopian Birr1.00", 3506 "Ethiopian birr1.00", 3507 "Ethiopian birrs1.00", 3508 "Euro1.00", 3509 "European Composite Unit1.00", 3510 "European Currency Unit1.00", 3511 "European Monetary Unit1.00", 3512 "European Unit of Account (XBC)1.00", 3513 "European Unit of Account (XBD)1.00", 3514 "European composite unit1.00", 3515 "European composite units1.00", 3516 "European currency unit1.00", 3517 "European currency units1.00", 3518 "European monetary unit1.00", 3519 "European monetary units1.00", 3520 "European unit of account (XBC)1.00", 3521 "European unit of account (XBD)1.00", 3522 "European units of account (XBC)1.00", 3523 "European units of account (XBD)1.00", 3524 "FJ$1.00", 3525 "FBu1.00", 3526 "FIM1.00", 3527 "FIM1.00", 3528 "FJD1.00", 3529 "FKP1.00", 3530 "FKP1.00", 3531 "FRF1.00", 3532 "FRF1.00", 3533 "Falkland Islands Pound1.00", 3534 "Falkland Islands pound1.00", 3535 "Falkland Islands pounds1.00", 3536 "Fdj1.00", 3537 "Fijian Dollar1.00", 3538 "Fijian dollar1.00", 3539 "Fijian dollars1.00", 3540 "Finnish Markka1.00", 3541 "Finnish markka1.00", 3542 "Finnish markkas1.00", 3543 "CHF1.00", 3544 "French Franc1.00", 3545 "French Gold Franc1.00", 3546 "French UIC-Franc1.00", 3547 "French UIC-franc1.00", 3548 "French UIC-francs1.00", 3549 "French franc1.00", 3550 "French francs1.00", 3551 "French gold franc1.00", 3552 "French gold francs1.00", 3553 "Ft1.00", 3554 "GY$1.00", 3555 "GBP1.00", 3556 "GEK1.00", 3557 "GEK1.00", 3558 "GEL1.00", 3559 "FG1.00", 3560 "GHC1.00", 3561 "GHC1.00", 3562 "GHS1.00", 3563 "GIP1.00", 3564 "GIP1.00", 3565 "GMD1.00", 3566 "GMD1.00", 3567 "GNF1.00", 3568 "GNS1.00", 3569 "GNS1.00", 3570 "GQE1.00", 3571 "GQE1.00", 3572 "GRD1.00", 3573 "GRD1.00", 3574 "GTQ1.00", 3575 "GWE1.00", 3576 "GWE1.00", 3577 "GWP1.00", 3578 "GWP1.00", 3579 "GYD1.00", 3580 "Gambian Dalasi1.00", 3581 "Gambian dalasi1.00", 3582 "Gambian dalasis1.00", 3583 "Georgian Kupon Larit1.00", 3584 "Georgian Lari1.00", 3585 "Georgian kupon larit1.00", 3586 "Georgian kupon larits1.00", 3587 "Georgian lari1.00", 3588 "Georgian laris1.00", 3589 "Ghanaian Cedi (1979-2007)1.00", 3590 "Ghanaian Cedi1.00", 3591 "Ghanaian cedi (GHC)1.00", 3592 "Ghanaian cedi1.00", 3593 "Ghanaian cedis (GHC)1.00", 3594 "Ghanaian cedis1.00", 3595 "Gibraltar Pound1.00", 3596 "Gibraltar pound1.00", 3597 "Gibraltar pounds1.00", 3598 "Gold1.00", 3599 "Gold1.00", 3600 "Greek Drachma1.00", 3601 "Greek drachma1.00", 3602 "Greek drachmas1.00", 3603 "Guatemalan Quetzal1.00", 3604 "Guatemalan quetzal1.00", 3605 "Guatemalan quetzals1.00", 3606 "Guinean Franc1.00", 3607 "Guinean Syli1.00", 3608 "Guinean franc1.00", 3609 "Guinean francs1.00", 3610 "Guinean syli1.00", 3611 "Guinean sylis1.00", 3612 "Guinea-Bissau Peso1.00", 3613 "Guinea-Bissau peso1.00", 3614 "Guinea-Bissau pesos1.00", 3615 "Guyanaese Dollar1.00", 3616 "Guyanaese dollar1.00", 3617 "Guyanaese dollars1.00", 3618 "HK$1.00", 3619 "HKD1.00", 3620 "HNL1.00", 3621 "HRD1.00", 3622 "HRD1.00", 3623 "HRK1.00", 3624 "HRK1.00", 3625 "HTG1.00", 3626 "HTG1.00", 3627 "HUF1.00", 3628 "Haitian Gourde1.00", 3629 "Haitian gourde1.00", 3630 "Haitian gourdes1.00", 3631 "Honduran Lempira1.00", 3632 "Honduran lempira1.00", 3633 "Honduran lempiras1.00", 3634 "Hong Kong Dollar1.00", 3635 "Hong Kong dollar1.00", 3636 "Hong Kong dollars1.00", 3637 "Hungarian Forint1.00", 3638 "Hungarian forint1.00", 3639 "Hungarian forints1.00", 3640 "IDR1.00", 3641 "IEP1.00", 3642 "ILP1.00", 3643 "ILP1.00", 3644 "ILS1.00", 3645 "INR1.00", 3646 "IQD1.00", 3647 "IRR1.00", 3648 "IR\\u00a31.00", 3649 "ISK1.00", 3650 "ISK1.00", 3651 "ITL1.00", 3652 "Icelandic Kr\\u00f3na1.00", 3653 "Icelandic kr\\u00f3na1.00", 3654 "Icelandic kr\\u00f3nur1.00", 3655 "Indian Rupee1.00", 3656 "Indian rupee1.00", 3657 "Indian rupees1.00", 3658 "Indonesian Rupiah1.00", 3659 "Indonesian rupiah1.00", 3660 "Indonesian rupiahs1.00", 3661 "Iranian Rial1.00", 3662 "Iranian rial1.00", 3663 "Iranian rials1.00", 3664 "Iraqi Dinar1.00", 3665 "Iraqi dinar1.00", 3666 "Iraqi dinars1.00", 3667 "Irish Pound1.00", 3668 "Irish pound1.00", 3669 "Irish pounds1.00", 3670 "Israeli Pound1.00", 3671 "Israeli new sheqel1.00", 3672 "Israeli pound1.00", 3673 "Israeli pounds1.00", 3674 "Italian Lira1.00", 3675 "Italian lira1.00", 3676 "Italian liras1.00", 3677 "J$1.00", 3678 "JD1.00", 3679 "JMD1.00", 3680 "JOD1.00", 3681 "JPY1.00", 3682 "Jamaican Dollar1.00", 3683 "Jamaican dollar1.00", 3684 "Jamaican dollars1.00", 3685 "Japanese Yen1.00", 3686 "Japanese yen1.00", 3687 "Jordanian Dinar1.00", 3688 "Jordanian dinar1.00", 3689 "Jordanian dinars1.00", 3690 "Ksh1.00", 3691 "KD1.00", 3692 "KES1.00", 3693 "KGS1.00", 3694 "KHR1.00", 3695 "KMF1.00", 3696 "KPW1.00", 3697 "KPW1.00", 3698 "KRW1.00", 3699 "KWD1.00", 3700 "KYD1.00", 3701 "KYD1.00", 3702 "KZT1.00", 3703 "Kazakhstan Tenge1.00", 3704 "Kazakhstan tenge1.00", 3705 "Kazakhstan tenges1.00", 3706 "Kenyan Shilling1.00", 3707 "Kenyan shilling1.00", 3708 "Kenyan shillings1.00", 3709 "Kuwaiti Dinar1.00", 3710 "Kuwaiti dinar1.00", 3711 "Kuwaiti dinars1.00", 3712 "Kyrgystani Som1.00", 3713 "Kyrgystani som1.00", 3714 "Kyrgystani soms1.00", 3715 "Kz1.00", 3716 "K\\u010d1.00", 3717 "HNL1.00", 3718 "LAK1.00", 3719 "LAK1.00", 3720 "LBP1.00", 3721 "LD1.00", 3722 "LKR1.00", 3723 "LB\\u00a31.00", 3724 "LRD1.00", 3725 "LRD1.00", 3726 "LSL1.00", 3727 "LTL1.00", 3728 "LTL1.00", 3729 "LTT1.00", 3730 "LTT1.00", 3731 "LUC1.00", 3732 "LUC1.00", 3733 "LUF1.00", 3734 "LUF1.00", 3735 "LUL1.00", 3736 "LUL1.00", 3737 "LVL1.00", 3738 "LVL1.00", 3739 "LVR1.00", 3740 "LVR1.00", 3741 "LYD1.00", 3742 "Laotian Kip1.00", 3743 "Laotian kip1.00", 3744 "Laotian kips1.00", 3745 "Latvian Lats1.00", 3746 "Latvian Ruble1.00", 3747 "Latvian lats1.00", 3748 "Latvian lati.00", 3749 "Latvian ruble1.00", 3750 "Latvian rubles1.00", 3751 "Lebanese Pound1.00", 3752 "Lebanese pound1.00", 3753 "Lebanese pounds1.00", 3754 "Lesotho Loti1.00", 3755 "Lesotho loti1.00", 3756 "Lesotho lotis1.00", 3757 "Liberian Dollar1.00", 3758 "Liberian dollar1.00", 3759 "Liberian dollars1.00", 3760 "Libyan Dinar1.00", 3761 "Libyan dinar1.00", 3762 "Libyan dinars1.00", 3763 "Lithuanian Litas1.00", 3764 "Lithuanian Talonas1.00", 3765 "Lithuanian litas1.00", 3766 "Lithuanian litai1.00", 3767 "Lithuanian talonas1.00", 3768 "Lithuanian talonases1.00", 3769 "Lm1.00", 3770 "Luxembourgian Convertible Franc1.00", 3771 "Luxembourg Financial Franc1.00", 3772 "Luxembourgian Franc1.00", 3773 "Luxembourgian convertible franc1.00", 3774 "Luxembourgian convertible francs1.00", 3775 "Luxembourg financial franc1.00", 3776 "Luxembourg financial francs1.00", 3777 "Luxembourgian franc1.00", 3778 "Luxembourgian francs1.00", 3779 "MAD1.00", 3780 "MAD1.00", 3781 "MAF1.00", 3782 "MAF1.00", 3783 "MDL1.00", 3784 "MDL1.00", 3785 "MX$1.00", 3786 "MGA1.00", 3787 "MGA1.00", 3788 "MGF1.00", 3789 "MGF1.00", 3790 "MKD1.00", 3791 "MLF1.00", 3792 "MLF1.00", 3793 "MMK1.00", 3794 "MMK1.00", 3795 "MNT1.00", 3796 "MOP1.00", 3797 "MOP1.00", 3798 "MRO1.00", 3799 "MTL1.00", 3800 "MTP1.00", 3801 "MTP1.00", 3802 "MTn1.00", 3803 "MUR1.00", 3804 "MUR1.00", 3805 "MVR1.00", 3806 "MVR1.00", 3807 "MWK1.00", 3808 "MXN1.00", 3809 "MXP1.00", 3810 "MXP1.00", 3811 "MXV1.00", 3812 "MXV1.00", 3813 "MYR1.00", 3814 "MZE1.00", 3815 "MZE1.00", 3816 "MZM1.00", 3817 "MZN1.00", 3818 "Macanese Pataca1.00", 3819 "Macanese pataca1.00", 3820 "Macanese patacas1.00", 3821 "Macedonian Denar1.00", 3822 "Macedonian denar1.00", 3823 "Macedonian denari1.00", 3824 "Malagasy Ariaries1.00", 3825 "Malagasy Ariary1.00", 3826 "Malagasy Ariary1.00", 3827 "Malagasy Franc1.00", 3828 "Malagasy franc1.00", 3829 "Malagasy francs1.00", 3830 "Malawian Kwacha1.00", 3831 "Malawian Kwacha1.00", 3832 "Malawian Kwachas1.00", 3833 "Malaysian Ringgit1.00", 3834 "Malaysian ringgit1.00", 3835 "Malaysian ringgits1.00", 3836 "Maldivian Rufiyaa1.00", 3837 "Maldivian rufiyaa1.00", 3838 "Maldivian rufiyaas1.00", 3839 "Malian Franc1.00", 3840 "Malian franc1.00", 3841 "Malian francs1.00", 3842 "Maltese Lira1.00", 3843 "Maltese Pound1.00", 3844 "Maltese lira1.00", 3845 "Maltese lira1.00", 3846 "Maltese pound1.00", 3847 "Maltese pounds1.00", 3848 "Mauritanian Ouguiya1.00", 3849 "Mauritanian ouguiya1.00", 3850 "Mauritanian ouguiyas1.00", 3851 "Mauritian Rupee1.00", 3852 "Mauritian rupee1.00", 3853 "Mauritian rupees1.00", 3854 "Mexican Peso1.00", 3855 "Mexican Silver Peso (1861-1992)1.00", 3856 "Mexican Unidad de Inversion (UDI)1.00", 3857 "Mexican peso1.00", 3858 "Mexican pesos1.00", 3859 "Mexican silver peso (MXP)1.00", 3860 "Mexican silver pesos (MXP)1.00", 3861 "Mexican unidad de inversion (UDI)1.00", 3862 "Mexican unidads de inversion (UDI)1.00", 3863 "Moldovan Leu1.00", 3864 "Moldovan leu1.00", 3865 "Moldovan lei1.00", 3866 "Mongolian Tugrik1.00", 3867 "Mongolian tugrik1.00", 3868 "Mongolian tugriks1.00", 3869 "Moroccan Dirham1.00", 3870 "Moroccan Franc1.00", 3871 "Moroccan dirham1.00", 3872 "Moroccan dirhams1.00", 3873 "Moroccan franc1.00", 3874 "Moroccan francs1.00", 3875 "Mozambican Escudo1.00", 3876 "Mozambican Metical1.00", 3877 "Mozambican escudo1.00", 3878 "Mozambican escudos1.00", 3879 "Mozambican metical1.00", 3880 "Mozambican meticals1.00", 3881 "Mt1.00", 3882 "Myanma Kyat1.00", 3883 "Myanma kyat1.00", 3884 "Myanma kyats1.00", 3885 "N$1.00", 3886 "NAD1.00", 3887 "NAf.1.00", 3888 "NGN1.00", 3889 "NIC1.00", 3890 "NIO1.00", 3891 "NIO1.00", 3892 "Nkr1.00", 3893 "NLG1.00", 3894 "NLG1.00", 3895 "NOK1.00", 3896 "NPR1.00", 3897 "NT$1.00", 3898 "NZ$1.00", 3899 "NZD1.00", 3900 "Namibian Dollar1.00", 3901 "Namibian dollar1.00", 3902 "Namibian dollars1.00", 3903 "Nepalese Rupee1.00", 3904 "Nepalese rupee1.00", 3905 "Nepalese rupees1.00", 3906 "Netherlands Antillean Guilder1.00", 3907 "Netherlands Antillean guilder1.00", 3908 "Netherlands Antillean guilders1.00", 3909 "Dutch Guilder1.00", 3910 "Dutch guilder1.00", 3911 "Dutch guilders1.00", 3912 "Israeli New Sheqel1.00", 3913 "Israeli New Sheqels1.00", 3914 "New Zealand Dollar1.00", 3915 "New Zealand dollar1.00", 3916 "New Zealand dollars1.00", 3917 "Nicaraguan Cordoba Oro1.00", 3918 "Nicaraguan Cordoba1.00", 3919 "Nicaraguan cordoba oro1.00", 3920 "Nicaraguan cordobas oro1.00", 3921 "Nicaraguan cordoba1.00", 3922 "Nicaraguan cordobas1.00", 3923 "Nigerian Naira1.00", 3924 "Nigerian naira1.00", 3925 "Nigerian nairas1.00", 3926 "North Korean Won1.00", 3927 "North Korean won1.00", 3928 "North Korean won1.00", 3929 "Norwegian Krone1.00", 3930 "Norwegian krone1.00", 3931 "Norwegian kroner1.00", 3932 "NPRs1.00", 3933 "Nu.1.00", 3934 "OMR1.00", 3935 "Old Mozambican Metical1.00", 3936 "Old Mozambican metical1.00", 3937 "Old Mozambican meticals1.00", 3938 "Old Romanian Lei1.00", 3939 "Old Romanian Leu1.00", 3940 "Old Romanian leu1.00", 3941 "Old Serbian Dinar1.00", 3942 "Old Serbian dinar1.00", 3943 "Old Serbian dinars1.00", 3944 "Old Sudanese Dinar1.00", 3945 "Old Sudanese Pound1.00", 3946 "Old Sudanese dinar1.00", 3947 "Old Sudanese dinars1.00", 3948 "Old Sudanese pound1.00", 3949 "Old Sudanese pounds1.00", 3950 "Old Turkish Lira1.00", 3951 "Old Turkish Lira1.00", 3952 "Omani Rial1.00", 3953 "Omani rial1.00", 3954 "Omani rials1.00", 3955 "PAB1.00", 3956 "PAB1.00", 3957 "PEI1.00", 3958 "PEI1.00", 3959 "PEN1.00", 3960 "PEN1.00", 3961 "PES1.00", 3962 "PES1.00", 3963 "PGK1.00", 3964 "PGK1.00", 3965 "PHP1.00", 3966 "PKR1.00", 3967 "PLN1.00", 3968 "PLZ1.00", 3969 "PLZ1.00", 3970 "PTE1.00", 3971 "PTE1.00", 3972 "PYG1.00", 3973 "Pakistani Rupee1.00", 3974 "Pakistani rupee1.00", 3975 "Pakistani rupees1.00", 3976 "Palladium1.00", 3977 "Palladium1.00", 3978 "Panamanian Balboa1.00", 3979 "Panamanian balboa1.00", 3980 "Panamanian balboas1.00", 3981 "Papua New Guinean Kina1.00", 3982 "Papua New Guinean kina1.00", 3983 "Papua New Guinean kina1.00", 3984 "Paraguayan Guarani1.00", 3985 "Paraguayan guarani1.00", 3986 "Paraguayan guaranis1.00", 3987 "Peruvian Inti1.00", 3988 "Peruvian Nuevo Sol1.00", 3989 "Peruvian Sol1.00", 3990 "Peruvian inti1.00", 3991 "Peruvian intis1.00", 3992 "Peruvian nuevo sol1.00", 3993 "Peruvian nuevos soles1.00", 3994 "Peruvian sol1.00", 3995 "Peruvian soles1.00", 3996 "Philippine Peso1.00", 3997 "Philippine peso1.00", 3998 "Philippine pesos1.00", 3999 "Platinum1.00", 4000 "Platinum1.00", 4001 "Polish Zloty (1950-1995)1.00", 4002 "Polish Zloty1.00", 4003 "Polish zlotys1.00", 4004 "Polish zloty (PLZ)1.00", 4005 "Polish zloty1.00", 4006 "Polish zlotys (PLZ)1.00", 4007 "Portuguese Escudo1.00", 4008 "Portuguese Guinea Escudo1.00", 4009 "Portuguese Guinea escudo1.00", 4010 "Portuguese Guinea escudos1.00", 4011 "Portuguese escudo1.00", 4012 "Portuguese escudos1.00", 4013 "PKRs1.00", 4014 "GTQ1.00", 4015 "QAR1.00", 4016 "QR1.00", 4017 "Qatari Rial1.00", 4018 "Qatari rial1.00", 4019 "Qatari rials1.00", 4020 "R1.00", 4021 "R$1.00", 4022 "RD$1.00", 4023 "RHD1.00", 4024 "RHD1.00", 4025 "RINET Funds1.00", 4026 "RINET Funds1.00", 4027 "RM1.00", 4028 "CN\\u00a51.00", 4029 "ROL1.00", 4030 "ROL1.00", 4031 "RON1.00", 4032 "RON1.00", 4033 "RSD1.00", 4034 "RSD1.00", 4035 "RUB1.00", 4036 "RUB1.00", 4037 "RUR1.00", 4038 "RUR1.00", 4039 "RWF1.00", 4040 "RWF1.00", 4041 "Rhodesian Dollar1.00", 4042 "Rhodesian dollar1.00", 4043 "Rhodesian dollars1.00", 4044 "Romanian Leu1.00", 4045 "Romanian lei1.00", 4046 "Romanian leu1.00", 4047 "Rp1.00", 4048 "Russian Ruble (1991-1998)1.00", 4049 "Russian Ruble1.00", 4050 "Russian ruble (RUR)1.00", 4051 "Russian ruble1.00", 4052 "Russian rubles (RUR)1.00", 4053 "Russian rubles1.00", 4054 "Rwandan Franc1.00", 4055 "Rwandan franc1.00", 4056 "Rwandan francs1.00", 4057 "S$1.00", 4058 "SAR1.00", 4059 "SBD1.00", 4060 "SCR1.00", 4061 "SDD1.00", 4062 "SDD1.00", 4063 "SDG1.00", 4064 "SDG1.00", 4065 "SDP1.00", 4066 "SDP1.00", 4067 "SEK1.00", 4068 "SGD1.00", 4069 "SHP1.00", 4070 "SHP1.00", 4071 "SI$1.00", 4072 "SIT1.00", 4073 "SIT1.00", 4074 "SKK1.00", 4075 "Skr1.00", 4076 "SLRs1.00", 4077 "SLL1.00", 4078 "SLL1.00", 4079 "SOS1.00", 4080 "SRD1.00", 4081 "SRD1.00", 4082 "SRG1.00", 4083 "SRe1.00", 4084 "STD1.00", 4085 "SUR1.00", 4086 "SUR1.00", 4087 "SVC1.00", 4088 "SVC1.00", 4089 "SYP1.00", 4090 "SZL1.00", 4091 "Saint Helena Pound1.00", 4092 "Saint Helena pound1.00", 4093 "Saint Helena pounds1.00", 4094 "S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe Dobra1.00", 4095 "S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe dobra1.00", 4096 "S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe dobras1.00", 4097 "Saudi Riyal1.00", 4098 "Saudi riyal1.00", 4099 "Saudi riyals1.00", 4100 "Serbian Dinar1.00", 4101 "Serbian dinar1.00", 4102 "Serbian dinars1.00", 4103 "Seychellois Rupee1.00", 4104 "Seychellois rupee1.00", 4105 "Seychellois rupees1.00", 4106 "Sf1.00", 4107 "Ssh1.00", 4108 "Sierra Leonean Leone1.00", 4109 "Sierra Leonean leone1.00", 4110 "Sierra Leonean leones1.00", 4111 "Silver1.00", 4112 "Silver1.00", 4113 "Singapore Dollar1.00", 4114 "Singapore dollar1.00", 4115 "Singapore dollars1.00", 4116 "Sk1.00", 4117 "Slovak Koruna1.00", 4118 "Slovak koruna1.00", 4119 "Slovak korunas1.00", 4120 "Slovenian Tolar1.00", 4121 "Slovenian tolar1.00", 4122 "Slovenian tolars1.00", 4123 "Solomon Islands Dollar1.00", 4124 "Solomon Islands dollar1.00", 4125 "Solomon Islands dollars1.00", 4126 "Somali Shilling1.00", 4127 "Somali shilling1.00", 4128 "Somali shillings1.00", 4129 "South African Rand (financial)1.00", 4130 "South African Rand1.00", 4131 "South African rand (financial)1.00", 4132 "South African rand1.00", 4133 "South African rands (financial)1.00", 4134 "South African rand1.00", 4135 "South Korean Won1.00", 4136 "South Korean won1.00", 4137 "South Korean won1.00", 4138 "Soviet Rouble1.00", 4139 "Soviet rouble1.00", 4140 "Soviet roubles1.00", 4141 "Spanish Peseta (A account)1.00", 4142 "Spanish Peseta (convertible account)1.00", 4143 "Spanish Peseta1.00", 4144 "Spanish peseta (A account)1.00", 4145 "Spanish peseta (convertible account)1.00", 4146 "Spanish peseta1.00", 4147 "Spanish pesetas (A account)1.00", 4148 "Spanish pesetas (convertible account)1.00", 4149 "Spanish pesetas1.00", 4150 "Special Drawing Rights1.00", 4151 "Sri Lanka Rupee1.00", 4152 "Sri Lanka rupee1.00", 4153 "Sri Lanka rupees1.00", 4154 "Sudanese Pound1.00", 4155 "Sudanese pound1.00", 4156 "Sudanese pounds1.00", 4157 "Surinamese Dollar1.00", 4158 "Surinamese dollar1.00", 4159 "Surinamese dollars1.00", 4160 "Suriname Guilder1.00", 4161 "Suriname guilder1.00", 4162 "Suriname guilders1.00", 4163 "Swazi Lilangeni1.00", 4164 "Swazi lilangeni1.00", 4165 "Swazi emalangeni1.00", 4166 "Swedish Krona1.00", 4167 "Swedish krona1.00", 4168 "Swedish kronor1.00", 4169 "Swiss Franc1.00", 4170 "Swiss franc1.00", 4171 "Swiss francs1.00", 4172 "Syrian Pound1.00", 4173 "Syrian pound1.00", 4174 "Syrian pounds1.00", 4175 "TSh1.00", 4176 "T$1.00", 4177 "THB1.00", 4178 "TJR1.00", 4179 "TJR1.00", 4180 "TJS1.00", 4181 "TJS1.00", 4182 "TL1.00", 4183 "TMM1.00", 4184 "TMM1.00", 4185 "TND1.00", 4186 "TND1.00", 4187 "TOP1.00", 4188 "TPE1.00", 4189 "TPE1.00", 4190 "TRL1.00", 4191 "TRY1.00", 4192 "TRY1.00", 4193 "TT$1.00", 4194 "TTD1.00", 4195 "TWD1.00", 4196 "TZS1.00", 4197 "New Taiwan Dollar1.00", 4198 "New Taiwan dollar1.00", 4199 "New Taiwan dollars1.00", 4200 "Tajikistani Ruble1.00", 4201 "Tajikistani Somoni1.00", 4202 "Tajikistani ruble1.00", 4203 "Tajikistani rubles1.00", 4204 "Tajikistani somoni1.00", 4205 "Tajikistani somonis1.00", 4206 "Tanzanian Shilling1.00", 4207 "Tanzanian shilling1.00", 4208 "Tanzanian shillings1.00", 4209 "Testing Currency Code1.00", 4210 "Testing Currency Code1.00", 4211 "Thai Baht1.00", 4212 "Thai baht1.00", 4213 "Thai baht1.00", 4214 "Timorese Escudo1.00", 4215 "Timorese escudo1.00", 4216 "Timorese escudos1.00", 4217 "Tk1.00", 4218 "Tongan Pa\\u02bbanga1.00", 4219 "Tongan pa\\u02bbanga1.00", 4220 "Tongan pa\\u02bbanga1.00", 4221 "Trinidad and Tobago Dollar1.00", 4222 "Trinidad and Tobago dollar1.00", 4223 "Trinidad and Tobago dollars1.00", 4224 "Tunisian Dinar1.00", 4225 "Tunisian dinar1.00", 4226 "Tunisian dinars1.00", 4227 "Turkish Lira1.00", 4228 "Turkish Lira1.00", 4229 "Turkish lira1.00", 4230 "Turkmenistani Manat1.00", 4231 "Turkmenistani manat1.00", 4232 "Turkmenistani manat1.00", 4233 "USh1.00", 4234 "UAE dirham1.00", 4235 "UAE dirhams1.00", 4236 "UAH1.00", 4237 "UAK1.00", 4238 "UAK1.00", 4239 "UGS1.00", 4240 "UGS1.00", 4241 "UGX1.00", 4242 "UM1.00", 4243 "US Dollar (Next day)1.00", 4244 "US Dollar (Same day)1.00", 4245 "US Dollar1.00", 4246 "US dollar (next day)1.00", 4247 "US dollar (same day)1.00", 4248 "US dollar1.00", 4249 "US dollars (next day)1.00", 4250 "US dollars (same day)1.00", 4251 "US dollars1.00", 4252 "USD1.00", 4253 "USN1.00", 4254 "USN1.00", 4255 "USS1.00", 4256 "USS1.00", 4257 "UYI1.00", 4258 "UYI1.00", 4259 "UYP1.00", 4260 "UYP1.00", 4261 "UYU1.00", 4262 "UZS1.00", 4263 "UZS1.00", 4264 "Ugandan Shilling (1966-1987)1.00", 4265 "Ugandan Shilling1.00", 4266 "Ugandan shilling (UGS)1.00", 4267 "Ugandan shilling1.00", 4268 "Ugandan shillings (UGS)1.00", 4269 "Ugandan shillings1.00", 4270 "Ukrainian Hryvnia1.00", 4271 "Ukrainian Karbovanets1.00", 4272 "Ukrainian hryvnia1.00", 4273 "Ukrainian hryvnias1.00", 4274 "Ukrainian karbovanets1.00", 4275 "Ukrainian karbovantsiv1.00", 4276 "Unidad de Valor Real1.00", 4277 "United Arab Emirates Dirham1.00", 4278 "Unknown or Invalid Currency1.00", 4279 "$U1.00", 4280 "Uruguayan Peso (1975-1993)1.00", 4281 "Uruguayan Peso1.00", 4282 "Uruguayan Peso en Unidades Indexadas1.00", 4283 "Uruguayan peso (UYP)1.00", 4284 "Uruguayan peso en unidades indexadas1.00", 4285 "Uruguayan peso1.00", 4286 "Uruguayan pesos (UYP)1.00", 4287 "Uruguayan pesos en unidades indexadas1.00", 4288 "Uruguayan pesos1.00", 4289 "Uzbekistan Som1.00", 4290 "Uzbekistan som1.00", 4291 "Uzbekistan som1.00", 4292 "VEB1.00", 4293 "VEF1.00", 4294 "VND1.00", 4295 "VT1.00", 4296 "VUV1.00", 4297 "Vanuatu Vatu1.00", 4298 "Vanuatu vatu1.00", 4299 "Vanuatu vatus1.00", 4300 "Venezuelan Bol\\u00edvar Fuerte1.00", 4301 "Venezuelan Bol\\u00edvar1.00", 4302 "Venezuelan bol\\u00edvar fuerte1.00", 4303 "Venezuelan bol\\u00edvars fuertes1.00", 4304 "Venezuelan bol\\u00edvar1.00", 4305 "Venezuelan bol\\u00edvars1.00", 4306 "Vietnamese Dong1.00", 4307 "Vietnamese dong1.00", 4308 "Vietnamese dong1.00", 4309 "WIR Euro1.00", 4310 "WIR Franc1.00", 4311 "WIR euro1.00", 4312 "WIR euros1.00", 4313 "WIR franc1.00", 4314 "WIR francs1.00", 4315 "WST1.00", 4316 "WST1.00", 4317 "Samoan Tala1.00", 4318 "Samoan tala1.00", 4319 "Samoan tala1.00", 4320 "XAF1.00", 4321 "XAF1.00", 4322 "XAG1.00", 4323 "XAG1.00", 4324 "XAU1.00", 4325 "XAU1.00", 4326 "XBA1.00", 4327 "XBA1.00", 4328 "XBB1.00", 4329 "XBB1.00", 4330 "XBC1.00", 4331 "XBC1.00", 4332 "XBD1.00", 4333 "XBD1.00", 4334 "XCD1.00", 4335 "XDR1.00", 4336 "XDR1.00", 4337 "XEU1.00", 4338 "XEU1.00", 4339 "XFO1.00", 4340 "XFO1.00", 4341 "XFU1.00", 4342 "XFU1.00", 4343 "XOF1.00", 4344 "XOF1.00", 4345 "XPD1.00", 4346 "XPD1.00", 4347 "XPF1.00", 4348 "XPT1.00", 4349 "XPT1.00", 4350 "XRE1.00", 4351 "XRE1.00", 4352 "XTS1.00", 4353 "XTS1.00", 4354 "XXX1.00", 4355 "XXX1.00", 4356 "YDD1.00", 4357 "YDD1.00", 4358 "YER1.00", 4359 "YUD1.00", 4360 "YUD1.00", 4361 "YUM1.00", 4362 "YUM1.00", 4363 "YUN1.00", 4364 "YUN1.00", 4365 "Yemeni Dinar1.00", 4366 "Yemeni Rial1.00", 4367 "Yemeni dinar1.00", 4368 "Yemeni dinars1.00", 4369 "Yemeni rial1.00", 4370 "Yemeni rials1.00", 4371 "Yugoslavian Convertible Dinar1.00", 4372 "Yugoslavian Hard Dinar1.00", 4373 "Yugoslavian Noviy Dinar1.00", 4374 "Yugoslavian Noviy dinars1.00", 4375 "Yugoslavian convertible dinar1.00", 4376 "Yugoslavian convertible dinars1.00", 4377 "Yugoslavian hard dinar1.00", 4378 "Yugoslavian hard dinars1.00", 4379 "Yugoslavian noviy dinar1.00", 4380 "Z$1.00", 4381 "ZAL1.00", 4382 "ZAL1.00", 4383 "ZAR1.00", 4384 "ZMK1.00", 4385 "ZMK1.00", 4386 "ZRN1.00", 4387 "ZRN1.00", 4388 "ZRZ1.00", 4389 "ZRZ1.00", 4390 "ZWD1.00", 4391 "Zairean New Zaire1.00", 4392 "Zairean Zaire1.00", 4393 "Zairean new zaire1.00", 4394 "Zairean new zaires1.00", 4395 "Zairean zaire1.00", 4396 "Zairean zaires1.00", 4397 "Zambian Kwacha1.00", 4398 "Zambian kwacha1.00", 4399 "Zambian kwachas1.00", 4400 "Zimbabwean Dollar1.00", 4401 "Zimbabwean dollar1.00", 4402 "Zimbabwean dollars1.00", 4403 "euro1.00", 4404 "euros1.00", 4405 "man.1.00", 4406 "old Turkish lira1.00", 4407 "special drawing rights1.00", 4408 "unidad de valor real1.00", 4409 "unidad de valor reals1.00", 4410 "unknown/invalid currency1.00", 4411 "z\\u01421.00", 4412 "\\u00a31.00", 4413 "CY\\u00a31.00", 4414 "\\u00a51.00", 4415 "\\u0e3f1.00", 4416 "\\u20ab1.00", 4417 "\\u20a11.00", 4418 "Pts1.00", 4419 "\\u20aa1.00", 4420 "\\u20ac1.00", 4421 "Rs1.00", 4422 "\\u20a61.00", 4423 "\\u20ae1.00", 4424 "IT\\u20a41.00", 4425 // for GHS 4426 // for PHP 4427 // for PYG 4428 // for UAH 4429 // 4430 // Following has extra text, should be parsed correctly too 4431 "$1.00 random", 4432 "USD1.00 random", 4433 "1.00 US dollar random", 4434 "1.00 US dollars random", 4435 "1.00 Afghan Afghani random", 4436 "1.00 Afghan Afghani random", 4437 "1.00 Afghan Afghanis (AFA) random", 4438 "1.00 Afghan Afghanis random", 4439 "1.00 Albanian Lek random", 4440 "1.00 Albanian lek random", 4441 "1.00 Albanian lek\\u00eb random", 4442 "1.00 Algerian Dinar random", 4443 "1.00 Algerian dinar random", 4444 "1.00 Algerian dinars random", 4445 "1.00 Andorran Peseta random", 4446 "1.00 Andorran peseta random", 4447 "1.00 Andorran pesetas random", 4448 "1.00 Angolan Kwanza (1977-1990) random", 4449 "1.00 Angolan Kwanza Reajustado (1995-1999) random", 4450 "1.00 Angolan Kwanza random", 4451 "1.00 Angolan New Kwanza (1990-2000) random", 4452 "1.00 Angolan kwanza (AOK) random", 4453 "1.00 Angolan kwanza reajustado (AOR) random", 4454 "1.00 Angolan kwanza random", 4455 "1.00 Angolan kwanzas (AOK) random", 4456 "1.00 Angolan kwanzas reajustado (AOR) random", 4457 "1.00 Angolan kwanzas random", 4458 "1.00 Angolan new kwanza (AON) random", 4459 "1.00 Angolan new kwanzas (AON) random", 4460 "1.00 Argentine Austral random", 4461 "1.00 Argentine Peso (1983-1985) random", 4462 "1.00 Argentine Peso random", 4463 "1.00 Argentine austral random", 4464 "1.00 Argentine australs random", 4465 "1.00 Argentine peso (ARP) random", 4466 "1.00 Argentine peso random", 4467 "1.00 Argentine pesos (ARP) random", 4468 "1.00 Argentine pesos random", 4469 "1.00 Armenian Dram random", 4470 "1.00 Armenian dram random", 4471 "1.00 Armenian drams random", 4472 "1.00 Aruban Florin random", 4473 "1.00 Aruban florin random", 4474 "1.00 Australian Dollar random", 4475 "1.00 Australian dollar random", 4476 "1.00 Australian dollars random", 4477 "1.00 Austrian Schilling random", 4478 "1.00 Austrian schilling random", 4479 "1.00 Austrian schillings random", 4480 "1.00 Azerbaijani Manat (1993-2006) random", 4481 "1.00 Azerbaijani Manat random", 4482 "1.00 Azerbaijani manat (AZM) random", 4483 "1.00 Azerbaijani manat random", 4484 "1.00 Azerbaijani manats (AZM) random", 4485 "1.00 Azerbaijani manats random", 4486 "1.00 Bahamian Dollar random", 4487 "1.00 Bahamian dollar random", 4488 "1.00 Bahamian dollars random", 4489 "1.00 Bahraini Dinar random", 4490 "1.00 Bahraini dinar random", 4491 "1.00 Bahraini dinars random", 4492 "1.00 Bangladeshi Taka random", 4493 "1.00 Bangladeshi taka random", 4494 "1.00 Bangladeshi takas random", 4495 "1.00 Barbadian Dollar random", 4496 "1.00 Barbadian dollar random", 4497 "1.00 Barbadian dollars random", 4498 "1.00 Belarusian New Ruble (1994-1999) random", 4499 "1.00 Belarusian Ruble random", 4500 "1.00 Belarusian new ruble (BYB) random", 4501 "1.00 Belarusian new rubles (BYB) random", 4502 "1.00 Belarusian ruble random", 4503 "1.00 Belarusian rubles random", 4504 "1.00 Belgian Franc (convertible) random", 4505 "1.00 Belgian Franc (financial) random", 4506 "1.00 Belgian Franc random", 4507 "1.00 Belgian franc (convertible) random", 4508 "1.00 Belgian franc (financial) random", 4509 "1.00 Belgian franc random", 4510 "1.00 Belgian francs (convertible) random", 4511 "1.00 Belgian francs (financial) random", 4512 "1.00 Belgian francs random", 4513 "1.00 Belize Dollar random", 4514 "1.00 Belize dollar random", 4515 "1.00 Belize dollars random", 4516 "1.00 Bermudan Dollar random", 4517 "1.00 Bermudan dollar random", 4518 "1.00 Bermudan dollars random", 4519 "1.00 Bhutanese Ngultrum random", 4520 "1.00 Bhutanese ngultrum random", 4521 "1.00 Bhutanese ngultrums random", 4522 "1.00 Bolivian Mvdol random", 4523 "1.00 Bolivian Peso random", 4524 "1.00 Bolivian mvdol random", 4525 "1.00 Bolivian mvdols random", 4526 "1.00 Bolivian peso random", 4527 "1.00 Bolivian pesos random", 4528 "1.00 Bolivian Boliviano random", 4529 "1.00 Bolivian Boliviano random", 4530 "1.00 Bolivian Bolivianos random", 4531 "1.00 Bosnia-Herzegovina Convertible Mark random", 4532 "1.00 Bosnia-Herzegovina Dinar random", 4533 "1.00 Bosnia-Herzegovina convertible mark random", 4534 "1.00 Bosnia-Herzegovina convertible marks random", 4535 "1.00 Bosnia-Herzegovina dinar random", 4536 "1.00 Bosnia-Herzegovina dinars random", 4537 "1.00 Botswanan Pula random", 4538 "1.00 Botswanan pula random", 4539 "1.00 Botswanan pulas random", 4540 "1.00 Brazilian Cruzado Novo random", 4541 "1.00 Brazilian Cruzado random", 4542 "1.00 Brazilian Cruzeiro (1990-1993) random", 4543 "1.00 Brazilian Cruzeiro Novo (1967-1986) random", 4544 "1.00 Brazilian Cruzeiro random", 4545 "1.00 Brazilian Real random", 4546 "1.00 Brazilian cruzado novo random", 4547 "1.00 Brazilian cruzado novos random", 4548 "1.00 Brazilian cruzado random", 4549 "1.00 Brazilian cruzados random", 4550 "1.00 Brazilian cruzeiro (BRE) random", 4551 "1.00 Brazilian cruzeiro novo (BRB) random", 4552 "1.00 Brazilian cruzeiro random", 4553 "1.00 Brazilian cruzeiros (BRE) random", 4554 "1.00 Brazilian cruzeiros novo (BRB) random", 4555 "1.00 Brazilian cruzeiros random", 4556 "1.00 Brazilian real random", 4557 "1.00 Brazilian reals random", 4558 "1.00 British Pound Sterling random", 4559 "1.00 British pound sterling random", 4560 "1.00 British pounds sterling random", 4561 "1.00 Brunei Dollar random", 4562 "1.00 Brunei dollar random", 4563 "1.00 Brunei dollars random", 4564 "1.00 Bulgarian Hard Lev random", 4565 "1.00 Bulgarian Lev random", 4566 "1.00 Bulgarian Leva random", 4567 "1.00 Bulgarian hard lev random", 4568 "1.00 Bulgarian hard leva random", 4569 "1.00 Bulgarian lev random", 4570 "1.00 Burmese Kyat random", 4571 "1.00 Burmese kyat random", 4572 "1.00 Burmese kyats random", 4573 "1.00 Burundian Franc random", 4574 "1.00 Burundian franc random", 4575 "1.00 Burundian francs random", 4576 "1.00 Cambodian Riel random", 4577 "1.00 Cambodian riel random", 4578 "1.00 Cambodian riels random", 4579 "1.00 Canadian Dollar random", 4580 "1.00 Canadian dollar random", 4581 "1.00 Canadian dollars random", 4582 "1.00 Cape Verdean Escudo random", 4583 "1.00 Cape Verdean escudo random", 4584 "1.00 Cape Verdean escudos random", 4585 "1.00 Cayman Islands Dollar random", 4586 "1.00 Cayman Islands dollar random", 4587 "1.00 Cayman Islands dollars random", 4588 "1.00 Chilean Peso random", 4589 "1.00 Chilean Unidades de Fomento random", 4590 "1.00 Chilean peso random", 4591 "1.00 Chilean pesos random", 4592 "1.00 Chilean unidades de fomento random", 4593 "1.00 Chilean unidades de fomentos random", 4594 "1.00 Chinese Yuan Renminbi random", 4595 "1.00 Chinese yuan random", 4596 "1.00 Colombian Peso random", 4597 "1.00 Colombian peso random", 4598 "1.00 Colombian pesos random", 4599 "1.00 Comorian Franc random", 4600 "1.00 Comorian franc random", 4601 "1.00 Comorian francs random", 4602 "1.00 Congolese Franc Congolais random", 4603 "1.00 Congolese franc Congolais random", 4604 "1.00 Congolese francs Congolais random", 4605 "1.00 Costa Rican Col\\u00f3n random", 4606 "1.00 Costa Rican col\\u00f3n random", 4607 "1.00 Costa Rican col\\u00f3ns random", 4608 "1.00 Croatian Dinar random", 4609 "1.00 Croatian Kuna random", 4610 "1.00 Croatian dinar random", 4611 "1.00 Croatian dinars random", 4612 "1.00 Croatian kuna random", 4613 "1.00 Croatian kunas random", 4614 "1.00 Cuban Peso random", 4615 "1.00 Cuban peso random", 4616 "1.00 Cuban pesos random", 4617 "1.00 Cypriot Pound random", 4618 "1.00 Cypriot pound random", 4619 "1.00 Cypriot pounds random", 4620 "1.00 Czech Republic Koruna random", 4621 "1.00 Czech Republic koruna random", 4622 "1.00 Czech Republic korunas random", 4623 "1.00 Czechoslovak Hard Koruna random", 4624 "1.00 Czechoslovak hard koruna random", 4625 "1.00 Czechoslovak hard korunas random", 4626 "1.00 Danish Krone random", 4627 "1.00 Danish krone random", 4628 "1.00 Danish kroner random", 4629 "1.00 German Mark random", 4630 "1.00 German mark random", 4631 "1.00 German marks random", 4632 "1.00 Djiboutian Franc random", 4633 "1.00 Djiboutian franc random", 4634 "1.00 Djiboutian francs random", 4635 "1.00 Dominican Peso random", 4636 "1.00 Dominican peso random", 4637 "1.00 Dominican pesos random", 4638 "1.00 East Caribbean Dollar random", 4639 "1.00 East Caribbean dollar random", 4640 "1.00 East Caribbean dollars random", 4641 "1.00 East German Mark random", 4642 "1.00 East German mark random", 4643 "1.00 East German marks random", 4644 "1.00 Ecuadorian Sucre random", 4645 "1.00 Ecuadorian Unidad de Valor Constante (UVC) random", 4646 "1.00 Ecuadorian sucre random", 4647 "1.00 Ecuadorian sucres random", 4648 "1.00 Ecuadorian unidad de valor Constante (UVC) random", 4649 "1.00 Ecuadorian unidads de valor Constante (UVC) random", 4650 "1.00 Egyptian Pound random", 4651 "1.00 Egyptian pound random", 4652 "1.00 Egyptian pounds random", 4653 "1.00 Salvadoran Col\\u00f3n random", 4654 "1.00 Salvadoran col\\u00f3n random", 4655 "1.00 Salvadoran colones random", 4656 "1.00 Equatorial Guinean Ekwele random", 4657 "1.00 Equatorial Guinean ekwele random", 4658 "1.00 Eritrean Nakfa random", 4659 "1.00 Eritrean nakfa random", 4660 "1.00 Eritrean nakfas random", 4661 "1.00 Estonian Kroon random", 4662 "1.00 Estonian kroon random", 4663 "1.00 Estonian kroons random", 4664 "1.00 Ethiopian Birr random", 4665 "1.00 Ethiopian birr random", 4666 "1.00 Ethiopian birrs random", 4667 "1.00 European Composite Unit random", 4668 "1.00 European Currency Unit random", 4669 "1.00 European Monetary Unit random", 4670 "1.00 European Unit of Account (XBC) random", 4671 "1.00 European Unit of Account (XBD) random", 4672 "1.00 European composite unit random", 4673 "1.00 European composite units random", 4674 "1.00 European currency unit random", 4675 "1.00 European currency units random", 4676 "1.00 European monetary unit random", 4677 "1.00 European monetary units random", 4678 "1.00 European unit of account (XBC) random", 4679 "1.00 European unit of account (XBD) random", 4680 "1.00 European units of account (XBC) random", 4681 "1.00 European units of account (XBD) random", 4682 "1.00 Falkland Islands Pound random", 4683 "1.00 Falkland Islands pound random", 4684 "1.00 Falkland Islands pounds random", 4685 "1.00 Fijian Dollar random", 4686 "1.00 Fijian dollar random", 4687 "1.00 Fijian dollars random", 4688 "1.00 Finnish Markka random", 4689 "1.00 Finnish markka random", 4690 "1.00 Finnish markkas random", 4691 "1.00 French Franc random", 4692 "1.00 French Gold Franc random", 4693 "1.00 French UIC-Franc random", 4694 "1.00 French UIC-franc random", 4695 "1.00 French UIC-francs random", 4696 "1.00 French franc random", 4697 "1.00 French francs random", 4698 "1.00 French gold franc random", 4699 "1.00 French gold francs random", 4700 "1.00 Gambian Dalasi random", 4701 "1.00 Gambian dalasi random", 4702 "1.00 Gambian dalasis random", 4703 "1.00 Georgian Kupon Larit random", 4704 "1.00 Georgian Lari random", 4705 "1.00 Georgian kupon larit random", 4706 "1.00 Georgian kupon larits random", 4707 "1.00 Georgian lari random", 4708 "1.00 Georgian laris random", 4709 "1.00 Ghanaian Cedi (1979-2007) random", 4710 "1.00 Ghanaian Cedi random", 4711 "1.00 Ghanaian cedi (GHC) random", 4712 "1.00 Ghanaian cedi random", 4713 "1.00 Ghanaian cedis (GHC) random", 4714 "1.00 Ghanaian cedis random", 4715 "1.00 Gibraltar Pound random", 4716 "1.00 Gibraltar pound random", 4717 "1.00 Gibraltar pounds random", 4718 "1.00 Gold random", 4719 "1.00 Gold random", 4720 "1.00 Greek Drachma random", 4721 "1.00 Greek drachma random", 4722 "1.00 Greek drachmas random", 4723 "1.00 Guatemalan Quetzal random", 4724 "1.00 Guatemalan quetzal random", 4725 "1.00 Guatemalan quetzals random", 4726 "1.00 Guinean Franc random", 4727 "1.00 Guinean Syli random", 4728 "1.00 Guinean franc random", 4729 "1.00 Guinean francs random", 4730 "1.00 Guinean syli random", 4731 "1.00 Guinean sylis random", 4732 "1.00 Guinea-Bissau Peso random", 4733 "1.00 Guinea-Bissau peso random", 4734 "1.00 Guinea-Bissau pesos random", 4735 "1.00 Guyanaese Dollar random", 4736 "1.00 Guyanaese dollar random", 4737 "1.00 Guyanaese dollars random", 4738 "1.00 Haitian Gourde random", 4739 "1.00 Haitian gourde random", 4740 "1.00 Haitian gourdes random", 4741 "1.00 Honduran Lempira random", 4742 "1.00 Honduran lempira random", 4743 "1.00 Honduran lempiras random", 4744 "1.00 Hong Kong Dollar random", 4745 "1.00 Hong Kong dollar random", 4746 "1.00 Hong Kong dollars random", 4747 "1.00 Hungarian Forint random", 4748 "1.00 Hungarian forint random", 4749 "1.00 Hungarian forints random", 4750 "1.00 Icelandic Kr\\u00f3na random", 4751 "1.00 Icelandic kr\\u00f3na random", 4752 "1.00 Icelandic kr\\u00f3nur random", 4753 "1.00 Indian Rupee random", 4754 "1.00 Indian rupee random", 4755 "1.00 Indian rupees random", 4756 "1.00 Indonesian Rupiah random", 4757 "1.00 Indonesian rupiah random", 4758 "1.00 Indonesian rupiahs random", 4759 "1.00 Iranian Rial random", 4760 "1.00 Iranian rial random", 4761 "1.00 Iranian rials random", 4762 "1.00 Iraqi Dinar random", 4763 "1.00 Iraqi dinar random", 4764 "1.00 Iraqi dinars random", 4765 "1.00 Irish Pound random", 4766 "1.00 Irish pound random", 4767 "1.00 Irish pounds random", 4768 "1.00 Israeli Pound random", 4769 "1.00 Israeli new sheqel random", 4770 "1.00 Israeli pound random", 4771 "1.00 Israeli pounds random", 4772 "1.00 Italian Lira random", 4773 "1.00 Italian lira random", 4774 "1.00 Italian liras random", 4775 "1.00 Jamaican Dollar random", 4776 "1.00 Jamaican dollar random", 4777 "1.00 Jamaican dollars random", 4778 "1.00 Japanese Yen random", 4779 "1.00 Japanese yen random", 4780 "1.00 Jordanian Dinar random", 4781 "1.00 Jordanian dinar random", 4782 "1.00 Jordanian dinars random", 4783 "1.00 Kazakhstan Tenge random", 4784 "1.00 Kazakhstan tenge random", 4785 "1.00 Kazakhstan tenges random", 4786 "1.00 Kenyan Shilling random", 4787 "1.00 Kenyan shilling random", 4788 "1.00 Kenyan shillings random", 4789 "1.00 Kuwaiti Dinar random", 4790 "1.00 Kuwaiti dinar random", 4791 "1.00 Kuwaiti dinars random", 4792 "1.00 Kyrgystani Som random", 4793 "1.00 Kyrgystani som random", 4794 "1.00 Kyrgystani soms random", 4795 "1.00 Laotian Kip random", 4796 "1.00 Laotian kip random", 4797 "1.00 Laotian kips random", 4798 "1.00 Latvian Lats random", 4799 "1.00 Latvian Ruble random", 4800 "1.00 Latvian lats random", 4801 "1.00 Latvian lati random", 4802 "1.00 Latvian ruble random", 4803 "1.00 Latvian rubles random", 4804 "1.00 Lebanese Pound random", 4805 "1.00 Lebanese pound random", 4806 "1.00 Lebanese pounds random", 4807 "1.00 Lesotho Loti random", 4808 "1.00 Lesotho loti random", 4809 "1.00 Lesotho lotis random", 4810 "1.00 Liberian Dollar random", 4811 "1.00 Liberian dollar random", 4812 "1.00 Liberian dollars random", 4813 "1.00 Libyan Dinar random", 4814 "1.00 Libyan dinar random", 4815 "1.00 Libyan dinars random", 4816 "1.00 Lithuanian Litas random", 4817 "1.00 Lithuanian Talonas random", 4818 "1.00 Lithuanian litas random", 4819 "1.00 Lithuanian litai random", 4820 "1.00 Lithuanian talonas random", 4821 "1.00 Lithuanian talonases random", 4822 "1.00 Luxembourgian Convertible Franc random", 4823 "1.00 Luxembourg Financial Franc random", 4824 "1.00 Luxembourgian Franc random", 4825 "1.00 Luxembourgian convertible franc random", 4826 "1.00 Luxembourgian convertible francs random", 4827 "1.00 Luxembourg financial franc random", 4828 "1.00 Luxembourg financial francs random", 4829 "1.00 Luxembourgian franc random", 4830 "1.00 Luxembourgian francs random", 4831 "1.00 Macanese Pataca random", 4832 "1.00 Macanese pataca random", 4833 "1.00 Macanese patacas random", 4834 "1.00 Macedonian Denar random", 4835 "1.00 Macedonian denar random", 4836 "1.00 Macedonian denari random", 4837 "1.00 Malagasy Ariaries random", 4838 "1.00 Malagasy Ariary random", 4839 "1.00 Malagasy Ariary random", 4840 "1.00 Malagasy Franc random", 4841 "1.00 Malagasy franc random", 4842 "1.00 Malagasy francs random", 4843 "1.00 Malawian Kwacha random", 4844 "1.00 Malawian Kwacha random", 4845 "1.00 Malawian Kwachas random", 4846 "1.00 Malaysian Ringgit random", 4847 "1.00 Malaysian ringgit random", 4848 "1.00 Malaysian ringgits random", 4849 "1.00 Maldivian Rufiyaa random", 4850 "1.00 Maldivian rufiyaa random", 4851 "1.00 Maldivian rufiyaas random", 4852 "1.00 Malian Franc random", 4853 "1.00 Malian franc random", 4854 "1.00 Malian francs random", 4855 "1.00 Maltese Lira random", 4856 "1.00 Maltese Pound random", 4857 "1.00 Maltese lira random", 4858 "1.00 Maltese liras random", 4859 "1.00 Maltese pound random", 4860 "1.00 Maltese pounds random", 4861 "1.00 Mauritanian Ouguiya random", 4862 "1.00 Mauritanian ouguiya random", 4863 "1.00 Mauritanian ouguiyas random", 4864 "1.00 Mauritian Rupee random", 4865 "1.00 Mauritian rupee random", 4866 "1.00 Mauritian rupees random", 4867 "1.00 Mexican Peso random", 4868 "1.00 Mexican Silver Peso (1861-1992) random", 4869 "1.00 Mexican Unidad de Inversion (UDI) random", 4870 "1.00 Mexican peso random", 4871 "1.00 Mexican pesos random", 4872 "1.00 Mexican silver peso (MXP) random", 4873 "1.00 Mexican silver pesos (MXP) random", 4874 "1.00 Mexican unidad de inversion (UDI) random", 4875 "1.00 Mexican unidads de inversion (UDI) random", 4876 "1.00 Moldovan Leu random", 4877 "1.00 Moldovan leu random", 4878 "1.00 Moldovan lei random", 4879 "1.00 Mongolian Tugrik random", 4880 "1.00 Mongolian tugrik random", 4881 "1.00 Mongolian tugriks random", 4882 "1.00 Moroccan Dirham random", 4883 "1.00 Moroccan Franc random", 4884 "1.00 Moroccan dirham random", 4885 "1.00 Moroccan dirhams random", 4886 "1.00 Moroccan franc random", 4887 "1.00 Moroccan francs random", 4888 "1.00 Mozambican Escudo random", 4889 "1.00 Mozambican Metical random", 4890 "1.00 Mozambican escudo random", 4891 "1.00 Mozambican escudos random", 4892 "1.00 Mozambican metical random", 4893 "1.00 Mozambican meticals random", 4894 "1.00 Myanma Kyat random", 4895 "1.00 Myanma kyat random", 4896 "1.00 Myanma kyats random", 4897 "1.00 Namibian Dollar random", 4898 "1.00 Namibian dollar random", 4899 "1.00 Namibian dollars random", 4900 "1.00 Nepalese Rupee random", 4901 "1.00 Nepalese rupee random", 4902 "1.00 Nepalese rupees random", 4903 "1.00 Netherlands Antillean Guilder random", 4904 "1.00 Netherlands Antillean guilder random", 4905 "1.00 Netherlands Antillean guilders random", 4906 "1.00 Dutch Guilder random", 4907 "1.00 Dutch guilder random", 4908 "1.00 Dutch guilders random", 4909 "1.00 Israeli New Sheqel random", 4910 "1.00 Israeli new sheqels random", 4911 "1.00 New Zealand Dollar random", 4912 "1.00 New Zealand dollar random", 4913 "1.00 New Zealand dollars random", 4914 "1.00 Nicaraguan Cordoba Oro random", 4915 "1.00 Nicaraguan Cordoba random", 4916 "1.00 Nicaraguan cordoba oro random", 4917 "1.00 Nicaraguan cordoba oros random", 4918 "1.00 Nicaraguan cordoba random", 4919 "1.00 Nicaraguan cordobas random", 4920 "1.00 Nigerian Naira random", 4921 "1.00 Nigerian naira random", 4922 "1.00 Nigerian nairas random", 4923 "1.00 North Korean Won random", 4924 "1.00 North Korean won random", 4925 "1.00 North Korean won random", 4926 "1.00 Norwegian Krone random", 4927 "1.00 Norwegian krone random", 4928 "1.00 Norwegian kroner random", 4929 "1.00 Old Mozambican Metical random", 4930 "1.00 Old Mozambican metical random", 4931 "1.00 Old Mozambican meticals random", 4932 "1.00 Old Romanian Lei random", 4933 "1.00 Old Romanian Leu random", 4934 "1.00 Old Romanian leu random", 4935 "1.00 Old Serbian Dinar random", 4936 "1.00 Old Serbian dinar random", 4937 "1.00 Old Serbian dinars random", 4938 "1.00 Old Sudanese Dinar random", 4939 "1.00 Old Sudanese Pound random", 4940 "1.00 Old Sudanese dinar random", 4941 "1.00 Old Sudanese dinars random", 4942 "1.00 Old Sudanese pound random", 4943 "1.00 Old Sudanese pounds random", 4944 "1.00 Old Turkish Lira random", 4945 "1.00 Old Turkish Lira random", 4946 "1.00 Omani Rial random", 4947 "1.00 Omani rial random", 4948 "1.00 Omani rials random", 4949 "1.00 Pakistani Rupee random", 4950 "1.00 Pakistani rupee random", 4951 "1.00 Pakistani rupees random", 4952 "1.00 Palladium random", 4953 "1.00 Palladium random", 4954 "1.00 Panamanian Balboa random", 4955 "1.00 Panamanian balboa random", 4956 "1.00 Panamanian balboas random", 4957 "1.00 Papua New Guinean Kina random", 4958 "1.00 Papua New Guinean kina random", 4959 "1.00 Papua New Guinean kina random", 4960 "1.00 Paraguayan Guarani random", 4961 "1.00 Paraguayan guarani random", 4962 "1.00 Paraguayan guaranis random", 4963 "1.00 Peruvian Inti random", 4964 "1.00 Peruvian Nuevo Sol random", 4965 "1.00 Peruvian Sol random", 4966 "1.00 Peruvian inti random", 4967 "1.00 Peruvian intis random", 4968 "1.00 Peruvian nuevo sol random", 4969 "1.00 Peruvian nuevos soles random", 4970 "1.00 Peruvian sol random", 4971 "1.00 Peruvian soles random", 4972 "1.00 Philippine Peso random", 4973 "1.00 Philippine peso random", 4974 "1.00 Philippine pesos random", 4975 "1.00 Platinum random", 4976 "1.00 Platinum random", 4977 "1.00 Polish Zloty (1950-1995) random", 4978 "1.00 Polish Zloty random", 4979 "1.00 Polish zlotys random", 4980 "1.00 Polish zloty (PLZ) random", 4981 "1.00 Polish zloty random", 4982 "1.00 Polish zlotys (PLZ) random", 4983 "1.00 Portuguese Escudo random", 4984 "1.00 Portuguese Guinea Escudo random", 4985 "1.00 Portuguese Guinea escudo random", 4986 "1.00 Portuguese Guinea escudos random", 4987 "1.00 Portuguese escudo random", 4988 "1.00 Portuguese escudos random", 4989 "1.00 Qatari Rial random", 4990 "1.00 Qatari rial random", 4991 "1.00 Qatari rials random", 4992 "1.00 RINET Funds random", 4993 "1.00 RINET Funds random", 4994 "1.00 Rhodesian Dollar random", 4995 "1.00 Rhodesian dollar random", 4996 "1.00 Rhodesian dollars random", 4997 "1.00 Romanian Leu random", 4998 "1.00 Romanian lei random", 4999 "1.00 Romanian leu random", 5000 "1.00 Russian Ruble (1991-1998) random", 5001 "1.00 Russian Ruble random", 5002 "1.00 Russian ruble (RUR) random", 5003 "1.00 Russian ruble random", 5004 "1.00 Russian rubles (RUR) random", 5005 "1.00 Russian rubles random", 5006 "1.00 Rwandan Franc random", 5007 "1.00 Rwandan franc random", 5008 "1.00 Rwandan francs random", 5009 "1.00 Saint Helena Pound random", 5010 "1.00 Saint Helena pound random", 5011 "1.00 Saint Helena pounds random", 5012 "1.00 S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe Dobra random", 5013 "1.00 S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe dobra random", 5014 "1.00 S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe dobras random", 5015 "1.00 Saudi Riyal random", 5016 "1.00 Saudi riyal random", 5017 "1.00 Saudi riyals random", 5018 "1.00 Serbian Dinar random", 5019 "1.00 Serbian dinar random", 5020 "1.00 Serbian dinars random", 5021 "1.00 Seychellois Rupee random", 5022 "1.00 Seychellois rupee random", 5023 "1.00 Seychellois rupees random", 5024 "1.00 Sierra Leonean Leone random", 5025 "1.00 Sierra Leonean leone random", 5026 "1.00 Sierra Leonean leones random", 5027 "1.00 Singapore Dollar random", 5028 "1.00 Singapore dollar random", 5029 "1.00 Singapore dollars random", 5030 "1.00 Slovak Koruna random", 5031 "1.00 Slovak koruna random", 5032 "1.00 Slovak korunas random", 5033 "1.00 Slovenian Tolar random", 5034 "1.00 Slovenian tolar random", 5035 "1.00 Slovenian tolars random", 5036 "1.00 Solomon Islands Dollar random", 5037 "1.00 Solomon Islands dollar random", 5038 "1.00 Solomon Islands dollars random", 5039 "1.00 Somali Shilling random", 5040 "1.00 Somali shilling random", 5041 "1.00 Somali shillings random", 5042 "1.00 South African Rand (financial) random", 5043 "1.00 South African Rand random", 5044 "1.00 South African rand (financial) random", 5045 "1.00 South African rand random", 5046 "1.00 South African rands (financial) random", 5047 "1.00 South African rand random", 5048 "1.00 South Korean Won random", 5049 "1.00 South Korean won random", 5050 "1.00 South Korean won random", 5051 "1.00 Soviet Rouble random", 5052 "1.00 Soviet rouble random", 5053 "1.00 Soviet roubles random", 5054 "1.00 Spanish Peseta (A account) random", 5055 "1.00 Spanish Peseta (convertible account) random", 5056 "1.00 Spanish Peseta random", 5057 "1.00 Spanish peseta (A account) random", 5058 "1.00 Spanish peseta (convertible account) random", 5059 "1.00 Spanish peseta random", 5060 "1.00 Spanish pesetas (A account) random", 5061 "1.00 Spanish pesetas (convertible account) random", 5062 "1.00 Spanish pesetas random", 5063 "1.00 Special Drawing Rights random", 5064 "1.00 Sri Lanka Rupee random", 5065 "1.00 Sri Lanka rupee random", 5066 "1.00 Sri Lanka rupees random", 5067 "1.00 Sudanese Pound random", 5068 "1.00 Sudanese pound random", 5069 "1.00 Sudanese pounds random", 5070 "1.00 Surinamese Dollar random", 5071 "1.00 Surinamese dollar random", 5072 "1.00 Surinamese dollars random", 5073 "1.00 Suriname Guilder random", 5074 "1.00 Suriname guilder random", 5075 "1.00 Suriname guilders random", 5076 "1.00 Swazi Lilangeni random", 5077 "1.00 Swazi lilangeni random", 5078 "1.00 Swazi emalangeni random", 5079 "1.00 Swedish Krona random", 5080 "1.00 Swedish krona random", 5081 "1.00 Swedish kronor random", 5082 "1.00 Swiss Franc random", 5083 "1.00 Swiss franc random", 5084 "1.00 Swiss francs random", 5085 "1.00 Syrian Pound random", 5086 "1.00 Syrian pound random", 5087 "1.00 Syrian pounds random", 5088 "1.00 New Taiwan Dollar random", 5089 "1.00 New Taiwan dollar random", 5090 "1.00 New Taiwan dollars random", 5091 "1.00 Tajikistani Ruble random", 5092 "1.00 Tajikistani Somoni random", 5093 "1.00 Tajikistani ruble random", 5094 "1.00 Tajikistani rubles random", 5095 "1.00 Tajikistani somoni random", 5096 "1.00 Tajikistani somonis random", 5097 "1.00 Tanzanian Shilling random", 5098 "1.00 Tanzanian shilling random", 5099 "1.00 Tanzanian shillings random", 5100 "1.00 Testing Currency Code random", 5101 "1.00 Testing Currency Code random", 5102 "1.00 Thai Baht random", 5103 "1.00 Thai baht random", 5104 "1.00 Thai baht random", 5105 "1.00 Timorese Escudo random", 5106 "1.00 Timorese escudo random", 5107 "1.00 Timorese escudos random", 5108 "1.00 Trinidad and Tobago Dollar random", 5109 "1.00 Trinidad and Tobago dollar random", 5110 "1.00 Trinidad and Tobago dollars random", 5111 "1.00 Tunisian Dinar random", 5112 "1.00 Tunisian dinar random", 5113 "1.00 Tunisian dinars random", 5114 "1.00 Turkish Lira random", 5115 "1.00 Turkish Lira random", 5116 "1.00 Turkish lira random", 5117 "1.00 Turkmenistani Manat random", 5118 "1.00 Turkmenistani manat random", 5119 "1.00 Turkmenistani manat random", 5120 "1.00 US Dollar (Next day) random", 5121 "1.00 US Dollar (Same day) random", 5122 "1.00 US Dollar random", 5123 "1.00 US dollar (next day) random", 5124 "1.00 US dollar (same day) random", 5125 "1.00 US dollar random", 5126 "1.00 US dollars (next day) random", 5127 "1.00 US dollars (same day) random", 5128 "1.00 US dollars random", 5129 "1.00 Ugandan Shilling (1966-1987) random", 5130 "1.00 Ugandan Shilling random", 5131 "1.00 Ugandan shilling (UGS) random", 5132 "1.00 Ugandan shilling random", 5133 "1.00 Ugandan shillings (UGS) random", 5134 "1.00 Ugandan shillings random", 5135 "1.00 Ukrainian Hryvnia random", 5136 "1.00 Ukrainian Karbovanets random", 5137 "1.00 Ukrainian hryvnia random", 5138 "1.00 Ukrainian hryvnias random", 5139 "1.00 Ukrainian karbovanets random", 5140 "1.00 Ukrainian karbovantsiv random", 5141 "1.00 Unidad de Valor Real random", 5142 "1.00 United Arab Emirates Dirham random", 5143 "1.00 Unknown or Invalid Currency random", 5144 "1.00 Uruguayan Peso (1975-1993) random", 5145 "1.00 Uruguayan Peso random", 5146 "1.00 Uruguayan Peso en Unidades Indexadas random", 5147 "1.00 Uruguayan peso (UYP) random", 5148 "1.00 Uruguayan peso en unidades indexadas random", 5149 "1.00 Uruguayan peso random", 5150 "1.00 Uruguayan pesos (UYP) random", 5151 "1.00 Uruguayan pesos en unidades indexadas random", 5152 "1.00 Uzbekistan Som random", 5153 "1.00 Uzbekistan som random", 5154 "1.00 Uzbekistan som random", 5155 "1.00 Vanuatu Vatu random", 5156 "1.00 Vanuatu vatu random", 5157 "1.00 Vanuatu vatus random", 5158 "1.00 Venezuelan Bol\\u00edvar Fuerte random", 5159 "1.00 Venezuelan Bol\\u00edvar random", 5160 "1.00 Venezuelan bol\\u00edvar fuerte random", 5161 "1.00 Venezuelan bol\\u00edvars fuertes random", 5162 "1.00 Venezuelan bol\\u00edvar random", 5163 "1.00 Venezuelan bol\\u00edvars random", 5164 "1.00 Vietnamese Dong random", 5165 "1.00 Vietnamese dong random", 5166 "1.00 Vietnamese dong random", 5167 "1.00 WIR Euro random", 5168 "1.00 WIR Franc random", 5169 "1.00 WIR euro random", 5170 "1.00 WIR euros random", 5171 "1.00 WIR franc random", 5172 "1.00 WIR francs random", 5173 "1.00 Samoan Tala random", 5174 "1.00 Samoan tala random", 5175 "1.00 Samoan tala random", 5176 "1.00 Yemeni Dinar random", 5177 "1.00 Yemeni Rial random", 5178 "1.00 Yemeni dinar random", 5179 "1.00 Yemeni dinars random", 5180 "1.00 Yemeni rial random", 5181 "1.00 Yemeni rials random", 5182 "1.00 Yugoslavian Convertible Dinar random", 5183 "1.00 Yugoslavian Hard Dinar random", 5184 "1.00 Yugoslavian Noviy Dinar random", 5185 "1.00 Yugoslavian Noviy dinars random", 5186 "1.00 Yugoslavian convertible dinar random", 5187 "1.00 Yugoslavian convertible dinars random", 5188 "1.00 Yugoslavian hard dinar random", 5189 "1.00 Yugoslavian hard dinars random", 5190 "1.00 Yugoslavian noviy dinar random", 5191 "1.00 Zairean New Zaire random", 5192 "1.00 Zairean Zaire random", 5193 "1.00 Zairean new zaire random", 5194 "1.00 Zairean new zaires random", 5195 "1.00 Zairean zaire random", 5196 "1.00 Zairean zaires random", 5197 "1.00 Zambian Kwacha random", 5198 "1.00 Zambian kwacha random", 5199 "1.00 Zambian kwachas random", 5200 "1.00 Zimbabwean Dollar random", 5201 "1.00 Zimbabwean dollar random", 5202 "1.00 Zimbabwean dollars random", 5203 "1.00 euro random", 5204 "1.00 euros random", 5205 "1.00 old Turkish lira random", 5206 "1.00 special drawing rights random", 5207 "1.00 unidad de valor real random", 5208 "1.00 unidad de valor reals random", 5209 "1.00 unknown/invalid currency random", 5210 }; 5211 5212 const char* WRONG_DATA[] = { 5213 // Following are missing one last char in the currency name 5214 "usd1.00", // case sensitive 5215 "1.00 Nicaraguan Cordob", 5216 "1.00 Namibian Dolla", 5217 "1.00 Namibian dolla", 5218 "1.00 Nepalese Rupe", 5219 "1.00 Nepalese rupe", 5220 "1.00 Netherlands Antillean Guilde", 5221 "1.00 Netherlands Antillean guilde", 5222 "1.00 Dutch Guilde", 5223 "1.00 Dutch guilde", 5224 "1.00 Israeli New Sheqe", 5225 "1.00 New Zealand Dolla", 5226 "1.00 New Zealand dolla", 5227 "1.00 Nicaraguan cordob", 5228 "1.00 Nigerian Nair", 5229 "1.00 Nigerian nair", 5230 "1.00 North Korean Wo", 5231 "1.00 North Korean wo", 5232 "1.00 Norwegian Kron", 5233 "1.00 Norwegian kron", 5234 "1.00 US dolla", 5235 "1.00", 5236 "A1.00", 5237 "AD1.00", 5238 "AE1.00", 5239 "AF1.00", 5240 "AL1.00", 5241 "AM1.00", 5242 "AN1.00", 5243 "AO1.00", 5244 "AR1.00", 5245 "AT1.00", 5246 "AU1.00", 5247 "AW1.00", 5248 "AZ1.00", 5249 "Afghan Afghan1.00", 5250 "Afghan Afghani (1927-20021.00", 5251 "Afl1.00", 5252 "Albanian Le1.00", 5253 "Algerian Dina1.00", 5254 "Andorran Peset1.00", 5255 "Angolan Kwanz1.00", 5256 "Angolan Kwanza (1977-19901.00", 5257 "Angolan Kwanza Reajustado (1995-19991.00", 5258 "Angolan New Kwanza (1990-20001.00", 5259 "Argentine Austra1.00", 5260 "Argentine Pes1.00", 5261 "Argentine Peso (1983-19851.00", 5262 "Armenian Dra1.00", 5263 "Aruban Flori1.00", 5264 "Australian Dolla1.00", 5265 "Austrian Schillin1.00", 5266 "Azerbaijani Mana1.00", 5267 "Azerbaijani Manat (1993-20061.00", 5268 "B1.00", 5269 "BA1.00", 5270 "BB1.00", 5271 "BE1.00", 5272 "BG1.00", 5273 "BH1.00", 5274 "BI1.00", 5275 "BM1.00", 5276 "BN1.00", 5277 "BO1.00", 5278 "BR1.00", 5279 "BS1.00", 5280 "BT1.00", 5281 "BU1.00", 5282 "BW1.00", 5283 "BY1.00", 5284 "BZ1.00", 5285 "Bahamian Dolla1.00", 5286 "Bahraini Dina1.00", 5287 "Bangladeshi Tak1.00", 5288 "Barbadian Dolla1.00", 5289 "Bds1.00", 5290 "Belarusian New Ruble (1994-19991.00", 5291 "Belarusian Rubl1.00", 5292 "Belgian Fran1.00", 5293 "Belgian Franc (convertible1.00", 5294 "Belgian Franc (financial1.00", 5295 "Belize Dolla1.00", 5296 "Bermudan Dolla1.00", 5297 "Bhutanese Ngultru1.00", 5298 "Bolivian Mvdo1.00", 5299 "Bolivian Pes1.00", 5300 "Bolivian Bolivian1.00", 5301 "Bosnia-Herzegovina Convertible Mar1.00", 5302 "Bosnia-Herzegovina Dina1.00", 5303 "Botswanan Pul1.00", 5304 "Brazilian Cruzad1.00", 5305 "Brazilian Cruzado Nov1.00", 5306 "Brazilian Cruzeir1.00", 5307 "Brazilian Cruzeiro (1990-19931.00", 5308 "Brazilian Cruzeiro Novo (1967-19861.00", 5309 "Brazilian Rea1.00", 5310 "British Pound Sterlin1.00", 5311 "Brunei Dolla1.00", 5312 "Bulgarian Hard Le1.00", 5313 "Bulgarian Le1.00", 5314 "Burmese Kya1.00", 5315 "Burundian Fran1.00", 5316 "C1.00", 5317 "CA1.00", 5318 "CD1.00", 5319 "CFA Franc BCEA1.00", 5320 "CFA Franc BEA1.00", 5321 "CFP Fran1.00", 5322 "CFP1.00", 5323 "CH1.00", 5324 "CL1.00", 5325 "CN1.00", 5326 "CO1.00", 5327 "CS1.00", 5328 "CU1.00", 5329 "CV1.00", 5330 "CY1.00", 5331 "CZ1.00", 5332 "Cambodian Rie1.00", 5333 "Canadian Dolla1.00", 5334 "Cape Verdean Escud1.00", 5335 "Cayman Islands Dolla1.00", 5336 "Chilean Pes1.00", 5337 "Chilean Unidades de Foment1.00", 5338 "Chinese Yuan Renminb1.00", 5339 "Colombian Pes1.00", 5340 "Comoro Fran1.00", 5341 "Congolese Fran1.00", 5342 "Costa Rican Col\\u00f31.00", 5343 "Croatian Dina1.00", 5344 "Croatian Kun1.00", 5345 "Cuban Pes1.00", 5346 "Cypriot Poun1.00", 5347 "Czech Republic Korun1.00", 5348 "Czechoslovak Hard Korun1.00", 5349 "D1.00", 5350 "DD1.00", 5351 "DE1.00", 5352 "DJ1.00", 5353 "DK1.00", 5354 "DO1.00", 5355 "DZ1.00", 5356 "Danish Kron1.00", 5357 "German Mar1.00", 5358 "Djiboutian Fran1.00", 5359 "Dk1.00", 5360 "Dominican Pes1.00", 5361 "EC1.00", 5362 "EE1.00", 5363 "EG1.00", 5364 "EQ1.00", 5365 "ER1.00", 5366 "ES1.00", 5367 "ET1.00", 5368 "EU1.00", 5369 "East Caribbean Dolla1.00", 5370 "East German Ostmar1.00", 5371 "Ecuadorian Sucr1.00", 5372 "Ecuadorian Unidad de Valor Constante (UVC1.00", 5373 "Egyptian Poun1.00", 5374 "Ekwel1.00", 5375 "Salvadoran Col\\u00f31.00", 5376 "Equatorial Guinean Ekwel1.00", 5377 "Eritrean Nakf1.00", 5378 "Es1.00", 5379 "Estonian Kroo1.00", 5380 "Ethiopian Bir1.00", 5381 "Eur1.00", 5382 "European Composite Uni1.00", 5383 "European Currency Uni1.00", 5384 "European Monetary Uni1.00", 5385 "European Unit of Account (XBC1.00", 5386 "European Unit of Account (XBD1.00", 5387 "F1.00", 5388 "FB1.00", 5389 "FI1.00", 5390 "FJ1.00", 5391 "FK1.00", 5392 "FR1.00", 5393 "Falkland Islands Poun1.00", 5394 "Fd1.00", 5395 "Fijian Dolla1.00", 5396 "Finnish Markk1.00", 5397 "Fr1.00", 5398 "French Fran1.00", 5399 "French Gold Fran1.00", 5400 "French UIC-Fran1.00", 5401 "G1.00", 5402 "GB1.00", 5403 "GE1.00", 5404 "GH1.00", 5405 "GI1.00", 5406 "GM1.00", 5407 "GN1.00", 5408 "GQ1.00", 5409 "GR1.00", 5410 "GT1.00", 5411 "GW1.00", 5412 "GY1.00", 5413 "Gambian Dalas1.00", 5414 "Georgian Kupon Lari1.00", 5415 "Georgian Lar1.00", 5416 "Ghanaian Ced1.00", 5417 "Ghanaian Cedi (1979-20071.00", 5418 "Gibraltar Poun1.00", 5419 "Gol1.00", 5420 "Greek Drachm1.00", 5421 "Guatemalan Quetza1.00", 5422 "Guinean Fran1.00", 5423 "Guinean Syl1.00", 5424 "Guinea-Bissau Pes1.00", 5425 "Guyanaese Dolla1.00", 5426 "HK1.00", 5427 "HN1.00", 5428 "HR1.00", 5429 "HT1.00", 5430 "HU1.00", 5431 "Haitian Gourd1.00", 5432 "Honduran Lempir1.00", 5433 "Hong Kong Dolla1.00", 5434 "Hungarian Forin1.00", 5435 "I1.00", 5436 "IE1.00", 5437 "IL1.00", 5438 "IN1.00", 5439 "IQ1.00", 5440 "IR1.00", 5441 "IS1.00", 5442 "IT1.00", 5443 "Icelandic Kron1.00", 5444 "Indian Rupe1.00", 5445 "Indonesian Rupia1.00", 5446 "Iranian Ria1.00", 5447 "Iraqi Dina1.00", 5448 "Irish Poun1.00", 5449 "Israeli Poun1.00", 5450 "Italian Lir1.00", 5451 "J1.00", 5452 "JM1.00", 5453 "JO1.00", 5454 "JP1.00", 5455 "Jamaican Dolla1.00", 5456 "Japanese Ye1.00", 5457 "Jordanian Dina1.00", 5458 "K S1.00", 5459 "K1.00", 5460 "KE1.00", 5461 "KG1.00", 5462 "KH1.00", 5463 "KP1.00", 5464 "KR1.00", 5465 "KW1.00", 5466 "KY1.00", 5467 "KZ1.00", 5468 "Kazakhstan Teng1.00", 5469 "Kenyan Shillin1.00", 5470 "Kuwaiti Dina1.00", 5471 "Kyrgystani So1.00", 5472 "LA1.00", 5473 "LB1.00", 5474 "LK1.00", 5475 "LR1.00", 5476 "LT1.00", 5477 "LU1.00", 5478 "LV1.00", 5479 "LY1.00", 5480 "Laotian Ki1.00", 5481 "Latvian Lat1.00", 5482 "Latvian Rubl1.00", 5483 "Lebanese Poun1.00", 5484 "Lesotho Lot1.00", 5485 "Liberian Dolla1.00", 5486 "Libyan Dina1.00", 5487 "Lithuanian Lit1.00", 5488 "Lithuanian Talona1.00", 5489 "Luxembourgian Convertible Fran1.00", 5490 "Luxembourg Financial Fran1.00", 5491 "Luxembourgian Fran1.00", 5492 "MA1.00", 5493 "MD1.00", 5494 "MDe1.00", 5495 "MEX1.00", 5496 "MG1.00", 5497 "ML1.00", 5498 "MM1.00", 5499 "MN1.00", 5500 "MO1.00", 5501 "MR1.00", 5502 "MT1.00", 5503 "MU1.00", 5504 "MV1.00", 5505 "MW1.00", 5506 "MX1.00", 5507 "MY1.00", 5508 "MZ1.00", 5509 "Macanese Patac1.00", 5510 "Macedonian Dena1.00", 5511 "Malagasy Ariar1.00", 5512 "Malagasy Fran1.00", 5513 "Malawian Kwach1.00", 5514 "Malaysian Ringgi1.00", 5515 "Maldivian Rufiya1.00", 5516 "Malian Fran1.00", 5517 "Malot1.00", 5518 "Maltese Lir1.00", 5519 "Maltese Poun1.00", 5520 "Mauritanian Ouguiy1.00", 5521 "Mauritian Rupe1.00", 5522 "Mexican Pes1.00", 5523 "Mexican Silver Peso (1861-19921.00", 5524 "Mexican Unidad de Inversion (UDI1.00", 5525 "Moldovan Le1.00", 5526 "Mongolian Tugri1.00", 5527 "Moroccan Dirha1.00", 5528 "Moroccan Fran1.00", 5529 "Mozambican Escud1.00", 5530 "Mozambican Metica1.00", 5531 "Myanma Kya1.00", 5532 "N1.00", 5533 "NA1.00", 5534 "NAf1.00", 5535 "NG1.00", 5536 "NI1.00", 5537 "NK1.00", 5538 "NL1.00", 5539 "NO1.00", 5540 "NP1.00", 5541 "NT1.00", 5542 "Namibian Dolla1.00", 5543 "Nepalese Rupe1.00", 5544 "Netherlands Antillean Guilde1.00", 5545 "Dutch Guilde1.00", 5546 "Israeli New Sheqe1.00", 5547 "New Zealand Dolla1.00", 5548 "Nicaraguan Cordob1.00", 5549 "Nicaraguan Cordoba Or1.00", 5550 "Nigerian Nair1.00", 5551 "North Korean Wo1.00", 5552 "Norwegian Kron1.00", 5553 "Nr1.00", 5554 "OM1.00", 5555 "Old Mozambican Metica1.00", 5556 "Old Romanian Le1.00", 5557 "Old Serbian Dina1.00", 5558 "Old Sudanese Dina1.00", 5559 "Old Sudanese Poun1.00", 5560 "Old Turkish Lir1.00", 5561 "Omani Ria1.00", 5562 "PA1.00", 5563 "PE1.00", 5564 "PG1.00", 5565 "PH1.00", 5566 "PK1.00", 5567 "PL1.00", 5568 "PT1.00", 5569 "PY1.00", 5570 "Pakistani Rupe1.00", 5571 "Palladiu1.00", 5572 "Panamanian Balbo1.00", 5573 "Papua New Guinean Kin1.00", 5574 "Paraguayan Guaran1.00", 5575 "Peruvian Int1.00", 5576 "Peruvian So1.00", 5577 "Peruvian Sol Nuev1.00", 5578 "Philippine Pes1.00", 5579 "Platinu1.00", 5580 "Polish Zlot1.00", 5581 "Polish Zloty (1950-19951.00", 5582 "Portuguese Escud1.00", 5583 "Portuguese Guinea Escud1.00", 5584 "Pr1.00", 5585 "QA1.00", 5586 "Qatari Ria1.00", 5587 "RD1.00", 5588 "RH1.00", 5589 "RINET Fund1.00", 5590 "RS1.00", 5591 "RU1.00", 5592 "RW1.00", 5593 "Rb1.00", 5594 "Rhodesian Dolla1.00", 5595 "Romanian Le1.00", 5596 "Russian Rubl1.00", 5597 "Russian Ruble (1991-19981.00", 5598 "Rwandan Fran1.00", 5599 "S1.00", 5600 "SA1.00", 5601 "SB1.00", 5602 "SC1.00", 5603 "SD1.00", 5604 "SE1.00", 5605 "SG1.00", 5606 "SH1.00", 5607 "SI1.00", 5608 "SK1.00", 5609 "SL R1.00", 5610 "SL1.00", 5611 "SO1.00", 5612 "ST1.00", 5613 "SU1.00", 5614 "SV1.00", 5615 "SY1.00", 5616 "SZ1.00", 5617 "Saint Helena Poun1.00", 5618 "S\\u00e3o Tom\\u00e9 and Pr\\u00edncipe Dobr1.00", 5619 "Saudi Riya1.00", 5620 "Serbian Dina1.00", 5621 "Seychellois Rupe1.00", 5622 "Sh1.00", 5623 "Sierra Leonean Leon1.00", 5624 "Silve1.00", 5625 "Singapore Dolla1.00", 5626 "Slovak Korun1.00", 5627 "Slovenian Tola1.00", 5628 "Solomon Islands Dolla1.00", 5629 "Somali Shillin1.00", 5630 "South African Ran1.00", 5631 "South African Rand (financial1.00", 5632 "South Korean Wo1.00", 5633 "Soviet Roubl1.00", 5634 "Spanish Peset1.00", 5635 "Spanish Peseta (A account1.00", 5636 "Spanish Peseta (convertible account1.00", 5637 "Special Drawing Right1.00", 5638 "Sri Lanka Rupe1.00", 5639 "Sudanese Poun1.00", 5640 "Surinamese Dolla1.00", 5641 "Suriname Guilde1.00", 5642 "Swazi Lilangen1.00", 5643 "Swedish Kron1.00", 5644 "Swiss Fran1.00", 5645 "Syrian Poun1.00", 5646 "T S1.00", 5647 "TH1.00", 5648 "TJ1.00", 5649 "TM1.00", 5650 "TN1.00", 5651 "TO1.00", 5652 "TP1.00", 5653 "TR1.00", 5654 "TT1.00", 5655 "TW1.00", 5656 "TZ1.00", 5657 "New Taiwan Dolla1.00", 5658 "Tajikistani Rubl1.00", 5659 "Tajikistani Somon1.00", 5660 "Tanzanian Shillin1.00", 5661 "Testing Currency Cod1.00", 5662 "Thai Bah1.00", 5663 "Timorese Escud1.00", 5664 "Tongan Pa\\u20bbang1.00", 5665 "Trinidad and Tobago Dolla1.00", 5666 "Tunisian Dina1.00", 5667 "Turkish Lir1.00", 5668 "Turkmenistani Mana1.00", 5669 "U S1.00", 5670 "U1.00", 5671 "UA1.00", 5672 "UG1.00", 5673 "US Dolla1.00", 5674 "US Dollar (Next day1.00", 5675 "US Dollar (Same day1.00", 5676 "US1.00", 5677 "UY1.00", 5678 "UZ1.00", 5679 "Ugandan Shillin1.00", 5680 "Ugandan Shilling (1966-19871.00", 5681 "Ukrainian Hryvni1.00", 5682 "Ukrainian Karbovanet1.00", 5683 "Unidad de Valor Rea1.00", 5684 "United Arab Emirates Dirha1.00", 5685 "Unknown or Invalid Currenc1.00", 5686 "Ur1.00", 5687 "Uruguay Peso (1975-19931.00", 5688 "Uruguay Peso Uruguay1.00", 5689 "Uruguay Peso en Unidades Indexada1.00", 5690 "Uzbekistan So1.00", 5691 "V1.00", 5692 "VE1.00", 5693 "VN1.00", 5694 "VU1.00", 5695 "Vanuatu Vat1.00", 5696 "Venezuelan Bol\\u00edva1.00", 5697 "Venezuelan Bol\\u00edvar Fuert1.00", 5698 "Vietnamese Don1.00", 5699 "WIR Eur1.00", 5700 "WIR Fran1.00", 5701 "WS1.00", 5702 "Samoa Tal1.00", 5703 "XA1.00", 5704 "XB1.00", 5705 "XC1.00", 5706 "XD1.00", 5707 "XE1.00", 5708 "XF1.00", 5709 "XO1.00", 5710 "XP1.00", 5711 "XR1.00", 5712 "XT1.00", 5713 "XX1.00", 5714 "YD1.00", 5715 "YE1.00", 5716 "YU1.00", 5717 "Yemeni Dina1.00", 5718 "Yemeni Ria1.00", 5719 "Yugoslavian Convertible Dina1.00", 5720 "Yugoslavian Hard Dina1.00", 5721 "Yugoslavian Noviy Dina1.00", 5722 "Z1.00", 5723 "ZA1.00", 5724 "ZM1.00", 5725 "ZR1.00", 5726 "ZW1.00", 5727 "Zairean New Zair1.00", 5728 "Zairean Zair1.00", 5729 "Zambian Kwach1.00", 5730 "Zimbabwean Dolla1.00", 5731 "dra1.00", 5732 "lar1.00", 5733 "le1.00", 5734 "man1.00", 5735 "so1.00", 5736 }; 5737 5738 Locale locale("en_US"); 5739 for (uint32_t i=0; i<sizeof(DATA)/sizeof(DATA[0]); ++i) { 5740 UnicodeString formatted = ctou(DATA[i]); 5741 UErrorCode status = U_ZERO_ERROR; 5742 NumberFormat* numFmt = NumberFormat::createInstance(locale, NumberFormat::kCurrencyStyle, status); 5743 Formattable parseResult; 5744 if (numFmt != NULL && U_SUCCESS(status)) { 5745 numFmt->parse(formatted, parseResult, status); 5746 if (U_FAILURE(status) || 5747 (parseResult.getType() == Formattable::kDouble && 5748 parseResult.getDouble() != 1.0)) { 5749 errln("wrong parsing, " + formatted); 5750 errln("data: " + formatted); 5751 } 5752 } else { 5753 dataerrln("Unable to create NumberFormat. - %s", u_errorName(status)); 5754 delete numFmt; 5755 break; 5756 } 5757 delete numFmt; 5758 } 5759 5760 for (uint32_t i=0; i<sizeof(WRONG_DATA)/sizeof(WRONG_DATA[0]); ++i) { 5761 UnicodeString formatted = ctou(WRONG_DATA[i]); 5762 UErrorCode status = U_ZERO_ERROR; 5763 NumberFormat* numFmt = NumberFormat::createInstance(locale, NumberFormat::kCurrencyStyle, status); 5764 Formattable parseResult; 5765 if (numFmt != NULL && U_SUCCESS(status)) { 5766 numFmt->parse(formatted, parseResult, status); 5767 if (!U_FAILURE(status) || 5768 (parseResult.getType() == Formattable::kDouble && 5769 parseResult.getDouble() == 1.0)) { 5770 errln("parsed but should not be: " + formatted); 5771 errln("data: " + formatted); 5772 } 5773 } else { 5774 dataerrln("Unable to create NumberFormat. - %s", u_errorName(status)); 5775 delete numFmt; 5776 break; 5777 } 5778 delete numFmt; 5779 } 5780 } 5781 5782 const char* attrString(int32_t); 5783 5784 // UnicodeString s; 5785 // std::string ss; 5786 // std::cout << s.toUTF8String(ss) 5787 void NumberFormatTest::expectPositions(FieldPositionIterator& iter, int32_t *values, int32_t tupleCount, 5788 const UnicodeString& str) { 5789 UBool found[10]; 5790 FieldPosition fp; 5791 5792 if (tupleCount > 10) { 5793 assertTrue("internal error, tupleCount too large", FALSE); 5794 } else { 5795 for (int i = 0; i < tupleCount; ++i) { 5796 found[i] = FALSE; 5797 } 5798 } 5799 5800 logln(str); 5801 while (iter.next(fp)) { 5802 UBool ok = FALSE; 5803 int32_t id = fp.getField(); 5804 int32_t start = fp.getBeginIndex(); 5805 int32_t limit = fp.getEndIndex(); 5806 5807 // is there a logln using printf? 5808 char buf[128]; 5809 sprintf(buf, "%24s %3d %3d %3d", attrString(id), id, start, limit); 5810 logln(buf); 5811 5812 for (int i = 0; i < tupleCount; ++i) { 5813 if (found[i]) { 5814 continue; 5815 } 5816 if (values[i*3] == id && 5817 values[i*3+1] == start && 5818 values[i*3+2] == limit) { 5819 found[i] = ok = TRUE; 5820 break; 5821 } 5822 } 5823 5824 assertTrue((UnicodeString)"found [" + id + "," + start + "," + limit + "]", ok); 5825 } 5826 5827 // check that all were found 5828 UBool ok = TRUE; 5829 for (int i = 0; i < tupleCount; ++i) { 5830 if (!found[i]) { 5831 ok = FALSE; 5832 assertTrue((UnicodeString) "missing [" + values[i*3] + "," + values[i*3+1] + "," + values[i*3+2] + "]", found[i]); 5833 } 5834 } 5835 assertTrue("no expected values were missing", ok); 5836 } 5837 5838 void NumberFormatTest::expectPosition(FieldPosition& pos, int32_t id, int32_t start, int32_t limit, 5839 const UnicodeString& str) { 5840 logln(str); 5841 assertTrue((UnicodeString)"id " + id + " == " + pos.getField(), id == pos.getField()); 5842 assertTrue((UnicodeString)"begin " + start + " == " + pos.getBeginIndex(), start == pos.getBeginIndex()); 5843 assertTrue((UnicodeString)"end " + limit + " == " + pos.getEndIndex(), limit == pos.getEndIndex()); 5844 } 5845 5846 void NumberFormatTest::TestFieldPositionIterator() { 5847 // bug 7372 5848 UErrorCode status = U_ZERO_ERROR; 5849 FieldPositionIterator iter1; 5850 FieldPositionIterator iter2; 5851 FieldPosition pos; 5852 5853 DecimalFormat *decFmt = (DecimalFormat *) NumberFormat::createInstance(status); 5854 if (failure(status, "NumberFormat::createInstance", TRUE)) return; 5855 5856 double num = 1234.56; 5857 UnicodeString str1; 5858 UnicodeString str2; 5859 5860 assertTrue((UnicodeString)"self==", iter1 == iter1); 5861 assertTrue((UnicodeString)"iter1==iter2", iter1 == iter2); 5862 5863 decFmt->format(num, str1, &iter1, status); 5864 assertTrue((UnicodeString)"iter1 != iter2", iter1 != iter2); 5865 decFmt->format(num, str2, &iter2, status); 5866 assertTrue((UnicodeString)"iter1 == iter2 (2)", iter1 == iter2); 5867 iter1.next(pos); 5868 assertTrue((UnicodeString)"iter1 != iter2 (2)", iter1 != iter2); 5869 iter2.next(pos); 5870 assertTrue((UnicodeString)"iter1 == iter2 (3)", iter1 == iter2); 5871 5872 // should format ok with no iterator 5873 str2.remove(); 5874 decFmt->format(num, str2, NULL, status); 5875 assertEquals("null fpiter", str1, str2); 5876 5877 delete decFmt; 5878 } 5879 5880 void NumberFormatTest::TestFormatAttributes() { 5881 Locale locale("en_US"); 5882 UErrorCode status = U_ZERO_ERROR; 5883 DecimalFormat *decFmt = (DecimalFormat *) NumberFormat::createInstance(locale, NumberFormat::kCurrencyStyle, status); 5884 if (failure(status, "NumberFormat::createInstance", TRUE)) return; 5885 double val = 12345.67; 5886 5887 { 5888 int32_t expected[] = { 5889 NumberFormat::kCurrencyField, 0, 1, 5890 NumberFormat::kGroupingSeparatorField, 3, 4, 5891 NumberFormat::kIntegerField, 1, 7, 5892 NumberFormat::kDecimalSeparatorField, 7, 8, 5893 NumberFormat::kFractionField, 8, 10, 5894 }; 5895 int32_t tupleCount = sizeof(expected)/(3 * sizeof(*expected)); 5896 5897 FieldPositionIterator posIter; 5898 UnicodeString result; 5899 decFmt->format(val, result, &posIter, status); 5900 expectPositions(posIter, expected, tupleCount, result); 5901 } 5902 { 5903 FieldPosition fp(NumberFormat::kIntegerField); 5904 UnicodeString result; 5905 decFmt->format(val, result, fp); 5906 expectPosition(fp, NumberFormat::kIntegerField, 1, 7, result); 5907 } 5908 { 5909 FieldPosition fp(NumberFormat::kFractionField); 5910 UnicodeString result; 5911 decFmt->format(val, result, fp); 5912 expectPosition(fp, NumberFormat::kFractionField, 8, 10, result); 5913 } 5914 delete decFmt; 5915 5916 decFmt = (DecimalFormat *) NumberFormat::createInstance(locale, NumberFormat::kScientificStyle, status); 5917 val = -0.0000123; 5918 { 5919 int32_t expected[] = { 5920 NumberFormat::kSignField, 0, 1, 5921 NumberFormat::kIntegerField, 1, 2, 5922 NumberFormat::kDecimalSeparatorField, 2, 3, 5923 NumberFormat::kFractionField, 3, 5, 5924 NumberFormat::kExponentSymbolField, 5, 6, 5925 NumberFormat::kExponentSignField, 6, 7, 5926 NumberFormat::kExponentField, 7, 8 5927 }; 5928 int32_t tupleCount = sizeof(expected)/(3 * sizeof(*expected)); 5929 5930 FieldPositionIterator posIter; 5931 UnicodeString result; 5932 decFmt->format(val, result, &posIter, status); 5933 expectPositions(posIter, expected, tupleCount, result); 5934 } 5935 { 5936 FieldPosition fp(NumberFormat::kIntegerField); 5937 UnicodeString result; 5938 decFmt->format(val, result, fp); 5939 expectPosition(fp, NumberFormat::kIntegerField, 1, 2, result); 5940 } 5941 { 5942 FieldPosition fp(NumberFormat::kFractionField); 5943 UnicodeString result; 5944 decFmt->format(val, result, fp); 5945 expectPosition(fp, NumberFormat::kFractionField, 3, 5, result); 5946 } 5947 delete decFmt; 5948 5949 fflush(stderr); 5950 } 5951 5952 const char* attrString(int32_t attrId) { 5953 switch (attrId) { 5954 case NumberFormat::kIntegerField: return "integer"; 5955 case NumberFormat::kFractionField: return "fraction"; 5956 case NumberFormat::kDecimalSeparatorField: return "decimal separator"; 5957 case NumberFormat::kExponentSymbolField: return "exponent symbol"; 5958 case NumberFormat::kExponentSignField: return "exponent sign"; 5959 case NumberFormat::kExponentField: return "exponent"; 5960 case NumberFormat::kGroupingSeparatorField: return "grouping separator"; 5961 case NumberFormat::kCurrencyField: return "currency"; 5962 case NumberFormat::kPercentField: return "percent"; 5963 case NumberFormat::kPermillField: return "permille"; 5964 case NumberFormat::kSignField: return "sign"; 5965 default: return ""; 5966 } 5967 } 5968 5969 // 5970 // Test formatting & parsing of big decimals. 5971 // API test, not a comprehensive test. 5972 // See DecimalFormatTest/DataDrivenTests 5973 // 5974 #define ASSERT_SUCCESS(status) {if (U_FAILURE(status)) errln("file %s, line %d: status: %s", \ 5975 __FILE__, __LINE__, u_errorName(status));} 5976 #define ASSERT_EQUALS(expected, actual) {if ((expected) != (actual)) \ 5977 errln("file %s, line %d: %s != %s", __FILE__, __LINE__, #expected, #actual);} 5978 5979 static UBool operator != (const char *s1, UnicodeString &s2) { 5980 // This function lets ASSERT_EQUALS("literal", UnicodeString) work. 5981 UnicodeString us1(s1); 5982 return us1 != s2; 5983 } 5984 5985 void NumberFormatTest::TestDecimal() { 5986 { 5987 UErrorCode status = U_ZERO_ERROR; 5988 Formattable f("12.345678999987654321E666", status); 5989 ASSERT_SUCCESS(status); 5990 StringPiece s = f.getDecimalNumber(status); 5991 ASSERT_SUCCESS(status); 5992 ASSERT_EQUALS("1.2345678999987654321E+667", s); 5993 //printf("%s\n", s.data()); 5994 } 5995 5996 { 5997 UErrorCode status = U_ZERO_ERROR; 5998 Formattable f1("this is not a number", status); 5999 ASSERT_EQUALS(U_DECIMAL_NUMBER_SYNTAX_ERROR, status); 6000 } 6001 6002 { 6003 UErrorCode status = U_ZERO_ERROR; 6004 Formattable f; 6005 f.setDecimalNumber("123.45", status); 6006 ASSERT_SUCCESS(status); 6007 ASSERT_EQUALS( Formattable::kDouble, f.getType()); 6008 ASSERT_EQUALS(123.45, f.getDouble()); 6009 ASSERT_EQUALS(123.45, f.getDouble(status)); 6010 ASSERT_SUCCESS(status); 6011 ASSERT_EQUALS("123.45", f.getDecimalNumber(status)); 6012 ASSERT_SUCCESS(status); 6013 6014 f.setDecimalNumber("4.5678E7", status); 6015 int32_t n; 6016 n = f.getLong(); 6017 ASSERT_EQUALS(45678000, n); 6018 6019 status = U_ZERO_ERROR; 6020 f.setDecimalNumber("-123", status); 6021 ASSERT_SUCCESS(status); 6022 ASSERT_EQUALS( Formattable::kLong, f.getType()); 6023 ASSERT_EQUALS(-123, f.getLong()); 6024 ASSERT_EQUALS(-123, f.getLong(status)); 6025 ASSERT_SUCCESS(status); 6026 ASSERT_EQUALS("-123", f.getDecimalNumber(status)); 6027 ASSERT_SUCCESS(status); 6028 6029 status = U_ZERO_ERROR; 6030 f.setDecimalNumber("1234567890123", status); // Number too big for 32 bits 6031 ASSERT_SUCCESS(status); 6032 ASSERT_EQUALS( Formattable::kInt64, f.getType()); 6033 ASSERT_EQUALS(1234567890123LL, f.getInt64()); 6034 ASSERT_EQUALS(1234567890123LL, f.getInt64(status)); 6035 ASSERT_SUCCESS(status); 6036 ASSERT_EQUALS("1234567890123", f.getDecimalNumber(status)); 6037 ASSERT_SUCCESS(status); 6038 } 6039 6040 { 6041 UErrorCode status = U_ZERO_ERROR; 6042 NumberFormat *fmtr = NumberFormat::createInstance( 6043 Locale::getUS(), NumberFormat::kNumberStyle, status); 6044 UnicodeString formattedResult; 6045 StringPiece num("244444444444444444444444444444444444446.4"); 6046 fmtr->format(num, formattedResult, NULL, status); 6047 ASSERT_SUCCESS(status); 6048 ASSERT_EQUALS("244,444,444,444,444,444,444,444,444,444,444,444,446.4", formattedResult); 6049 //std::string ss; std::cout << formattedResult.toUTF8String(ss); 6050 delete fmtr; 6051 } 6052 6053 { 6054 // Check formatting a DigitList. DigitList is internal, but this is 6055 // a critical interface that must work. 6056 UErrorCode status = U_ZERO_ERROR; 6057 NumberFormat *fmtr = NumberFormat::createInstance( 6058 Locale::getUS(), NumberFormat::kNumberStyle, status); 6059 ASSERT_SUCCESS(status); 6060 UnicodeString formattedResult; 6061 DigitList dl; 6062 StringPiece num("123.4566666666666666666666666666666666621E+40"); 6063 dl.set(num, status); 6064 ASSERT_SUCCESS(status); 6065 fmtr->format(dl, formattedResult, NULL, status); 6066 ASSERT_SUCCESS(status); 6067 ASSERT_EQUALS("1,234,566,666,666,666,666,666,666,666,666,666,666,621,000", formattedResult); 6068 6069 status = U_ZERO_ERROR; 6070 num.set("666.666"); 6071 dl.set(num, status); 6072 FieldPosition pos(NumberFormat::FRACTION_FIELD); 6073 ASSERT_SUCCESS(status); 6074 formattedResult.remove(); 6075 fmtr->format(dl, formattedResult, pos, status); 6076 ASSERT_SUCCESS(status); 6077 ASSERT_EQUALS("666.666", formattedResult); 6078 ASSERT_EQUALS(4, pos.getBeginIndex()); 6079 ASSERT_EQUALS(7, pos.getEndIndex()); 6080 delete fmtr; 6081 } 6082 6083 { 6084 // Check a parse with a formatter with a multiplier. 6085 UErrorCode status = U_ZERO_ERROR; 6086 NumberFormat *fmtr = NumberFormat::createInstance( 6087 Locale::getUS(), NumberFormat::kPercentStyle, status); 6088 ASSERT_SUCCESS(status); 6089 UnicodeString input = "1.84%"; 6090 Formattable result; 6091 fmtr->parse(input, result, status); 6092 ASSERT_SUCCESS(status); 6093 ASSERT_EQUALS(0, strcmp("0.0184", result.getDecimalNumber(status).data())); 6094 //std::cout << result.getDecimalNumber(status).data(); 6095 delete fmtr; 6096 } 6097 6098 { 6099 // Check that a parse returns a decimal number with full accuracy 6100 UErrorCode status = U_ZERO_ERROR; 6101 NumberFormat *fmtr = NumberFormat::createInstance( 6102 Locale::getUS(), NumberFormat::kNumberStyle, status); 6103 ASSERT_SUCCESS(status); 6104 UnicodeString input = "1.002200044400088880000070000"; 6105 Formattable result; 6106 fmtr->parse(input, result, status); 6107 ASSERT_SUCCESS(status); 6108 ASSERT_EQUALS(0, strcmp("1.00220004440008888000007", result.getDecimalNumber(status).data())); 6109 ASSERT_EQUALS(1.00220004440008888, result.getDouble()); 6110 //std::cout << result.getDecimalNumber(status).data(); 6111 delete fmtr; 6112 } 6113 6114 } 6115 6116 #endif /* #if !UCONFIG_NO_FORMATTING */ 6117