diff --git a/icu4c/source/test/cintltst/cloctst.c b/icu4c/source/test/cintltst/cloctst.c index 161a270959..7e90a7ebf9 100644 --- a/icu4c/source/test/cintltst/cloctst.c +++ b/icu4c/source/test/cintltst/cloctst.c @@ -1143,6 +1143,72 @@ static void TestObsoleteNames(void) } +/** + * List of all valid ISO 4217 codes. Include historical as well as + * current codes. This list must be updated to include any new + * currencies added to ICU. We check locale data against this list to + * ensure that invalid currency codes are not added. + */ +static const char* ISO_4217[] = { + /* Modern currencies */ + "ADP", "AED", "AFN", "ALL", "AMD", "ANG", "AOA", "ARS", "AUD", "AWG", + "AZM", "BAM", "BBD", "BDT", "BGL", "BGN", "BHD", "BIF", "BMD", "BND", + "BOB", "BOV", "BRL", "BSD", "BTN", "BWP", "BYR", "BZD", "CAD", "CDF", + "CHF", "CLF", "CLP", "CNY", "COP", "CRC", "CUP", "CVE", "CYP", "CZK", + "DJF", "DKK", "DOP", "DZD", "ECS", "ECV", "EEK", "EGP", "ERN", "ETB", + "EUR", "FJD", "FKP", "GBP", "GEL", "GHC", "GIP", "GMD", "GNF", "GTQ", + "GWP", "GYD", "HKD", "HNL", "HRK", "HTG", "HUF", "IDR", "ILS", "INR", + "IQD", "IRR", "ISK", "JMD", "JOD", "JPY", "KES", "KGS", "KHR", "KMF", + "KPW", "KRW", "KWD", "KYD", "KZT", "LAK", "LBP", "LKR", "LRD", "LSL", + "LTL", "LVL", "LYD", "MAD", "MDL", "MGF", "MKD", "MMK", "MNT", "MOP", + "MRO", "MTL", "MUR", "MVR", "MWK", "MXN", "MXV", "MYR", "MZM", "NAD", + "NGN", "NIO", "NOK", "NPR", "NZD", "OMR", "PAB", "PEN", "PGK", "PHP", + "PKR", "PLN", "PYG", "QAR", "ROL", "RUB", "RUR", "RWF", "SAR", "SBD", + "SCR", "SDD", "SEK", "SGD", "SHP", "SIT", "SKK", "SLL", "SOS", "SRG", + "STD", "SVC", "SYP", "SZL", "THB", "TJS", "TMM", "TND", "TOP", "TRL", + "TTD", "TWD", "TZS", "UAH", "UGX", "USD", "USN", "USS", "UYU", "UZS", + "VEB", "VND", "VUV", "WST", "XAF", "XCD", "XOF", "XPF", "YER", "YUM", + "ZAR", "ZMK", "ZWD", + + /* From ISO 4217:1981 */ + "AFA", "AOK", "AON", "ARP", "ATS", "BEC", "BEF", "BEL", "BOP", "BRC", + "BRR", "BUK", "CSK", "DDM", "DEM", "ESA", "ESB", "ESP", "FIM", "FRF", + "GEK", "GNS", "GQE", "GRD", "IEP", "ITL", "LSM", "LUF", "MLF", "MTP", + "MXP", "NIC", "NLG", "PES", "PLZ", "PTE", "SDP", "SUR", "TPE", "UAK", + "UGS", "UYP", "XAU", "XBA", "XBB", "XBC", "XBD", "XDR", "XEU", "XXX", + "YDD", "YUD", "ZAL", "ZRZ", + + /* Obsolete currencies, less well-documented */ + "AOR", /* ANGOLA Kwanza Readjustado */ + "ARA", /* ARGENTINA Austral */ + "BAD", /* BOSNIA Bosnian Dinar */ + "BYB", /* BELARUS Belarussian Ruble */ + "HRD", /* CROATIA Croatian Dinar */ + "PEI", /* PERU Inti */ + "TJR", /* TAJIKISTAN Tajik Ruble */ + "YUN" /* YUGOSLAVIA Yugoslavian Dinar */ + + /* Invalid codes that are sometimes seen: + "DRP", + "ECU", + "KIS", + "NIS", + "RMB", + */ +}; + +static const int32_t ISO_4217_COUNT = sizeof(ISO_4217)/sizeof(ISO_4217[0]); + +static UBool isValidISO4217(const char* curr) { + int32_t i; + for (i=0; i