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