+ // Test get currency spacing before the currency.
+ status = U_ZERO_ERROR;
+ for (int32_t i = 0; i < (int32_t)UNUM_CURRENCY_SPACING_COUNT; i++) {
+ UnicodeString enCurrencyPattern = en.getPatternForCurrencySpacing(
+ (UCurrencySpacing)i, TRUE, status);
+ if(U_FAILURE(status)) {
+ errln("Error: cannot get CurrencyMatch for locale:en");
+ status = U_ZERO_ERROR;
+ }
+ UnicodeString frCurrencyPattern = fr.getPatternForCurrencySpacing(
+ (UCurrencySpacing)i, TRUE, status);
+ if(U_FAILURE(status)) {
+ errln("Error: cannot get CurrencyMatch for locale:fr");
+ }
+ if (enCurrencyPattern != frCurrencyPattern) {
+ errln("ERROR: get CurrencySpacing failed");
+ }
+ }
+ // Test get currencySpacing after the currency.
+ status = U_ZERO_ERROR;
+ for (int32_t i = 0; i < UNUM_CURRENCY_SPACING_COUNT; i++) {
+ UnicodeString enCurrencyPattern = en.getPatternForCurrencySpacing(
+ (UCurrencySpacing)i, FALSE, status);
+ if(U_FAILURE(status)) {
+ errln("Error: cannot get CurrencyMatch for locale:en");
+ status = U_ZERO_ERROR;
+ }
+ UnicodeString frCurrencyPattern = fr.getPatternForCurrencySpacing(
+ (UCurrencySpacing)i, FALSE, status);
+ if(U_FAILURE(status)) {
+ errln("Error: cannot get CurrencyMatch for locale:fr");
+ }
+ if (enCurrencyPattern != frCurrencyPattern) {
+ errln("ERROR: get CurrencySpacing failed");
+ }
+ }
+ // Test set curerncySpacing APIs
+ status = U_ZERO_ERROR;
+ UnicodeString dash = UnicodeString("-");
+ en.setPatternForCurrencySpacing(UNUM_CURRENCY_INSERT, TRUE, dash);
+ UnicodeString enCurrencyInsert = en.getPatternForCurrencySpacing(
+ UNUM_CURRENCY_INSERT, TRUE, status);
+ if (dash != enCurrencyInsert) {
+ errln("Error: Failed to setCurrencyInsert for locale:en");
+ }
+