k != NumberFormat.ISOCURRENCYSTYLE &&
k != NumberFormat.PLURALCURRENCYSTYLE ) {
continue;
}
String localeString = DATA[i][0];
Double numberToBeFormat = new Double(DATA[i][1]);
String currencyISOCode = DATA[i][2];
ULocale locale = new ULocale(localeString);
NumberFormat numFmt = NumberFormat.getInstance(locale, k);
numFmt.setCurrency(Currency.getInstance(currencyISOCode));
String strBuf = numFmt.format(numberToBeFormat);
int resultDataIndex = k-1;
if ( k == NumberFormat.CURRENCYSTYLE ) {
resultDataIndex = k+2;
}
// DATA[i][resultDataIndex] is the currency format result
// using 'k' currency style.
String formatResult = DATA[i][resultDataIndex];
if (!strBuf.equals(formatResult)) {
errln("FAIL: Expected " + formatResult + " actual: " + Utility.escape(strBuf));
}
try {
// test parsing, and test parsing for all currency formats.
for (int j = 3; j < 6; ++j) {
// DATA[i][3] is the currency format result using
// CURRENCYSTYLE formatter.
// DATA[i][4] is the currency format result using
// ISOCURRENCYSTYLE formatter.
// DATA[i][5] is the currency format result using
// PLURALCURRENCYSTYLE formatter.
String oneCurrencyFormatResult = DATA[i][j];
Number val = numFmt.parse(oneCurrencyFormatResult);
if (val.doubleValue() != numberToBeFormat.doubleValue()) {
errln("FAIL: getCurrencyFormat of locale " + localeString + " failed roundtripping the number. val=" + val + "; expected: " + numberToBeFormat);
}
}
}
catch (ParseException e) {