From 50bdd810ef95a82a5d508ad909a71fd95cd1be6c Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Thu, 17 May 2018 02:47:29 +0000 Subject: [PATCH] ICU-13740 Re-formatting Java NumberFormatDataDrivenTest.java X-SVN-Rev: 41396 --- .../format/NumberFormatDataDrivenTest.java | 1219 ++++++++--------- 1 file changed, 608 insertions(+), 611 deletions(-) diff --git a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatDataDrivenTest.java b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatDataDrivenTest.java index 35ff0bad797..e2602138090 100644 --- a/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatDataDrivenTest.java +++ b/icu4j/main/tests/core/src/com/ibm/icu/dev/test/format/NumberFormatDataDrivenTest.java @@ -26,103 +26,102 @@ import com.ibm.icu.util.ULocale; public class NumberFormatDataDrivenTest { - private static ULocale EN = new ULocale("en"); - - private static Number toNumber(String s) { - if (s.equals("NaN")) { - return Double.NaN; - } else if (s.equals("-Inf")) { - return Double.NEGATIVE_INFINITY; - } else if (s.equals("Inf")) { - return Double.POSITIVE_INFINITY; + private static ULocale EN = new ULocale("en"); + + private static Number toNumber(String s) { + if (s.equals("NaN")) { + return Double.NaN; + } else if (s.equals("-Inf")) { + return Double.NEGATIVE_INFINITY; + } else if (s.equals("Inf")) { + return Double.POSITIVE_INFINITY; + } + return new BigDecimal(s); } - return new BigDecimal(s); - } - private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU58 = - new DataDrivenNumberFormatTestUtility.CodeUnderTest() { + private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU58 = new DataDrivenNumberFormatTestUtility.CodeUnderTest() { @Override public Character Id() { - return 'J'; + return 'J'; } @Override public String format(DataDrivenNumberFormatTestData tuple) { - DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); - String actual = fmt.format(toNumber(tuple.format)); - String expected = tuple.output; - if (!expected.equals(actual)) { - return "Expected " + expected + ", got " + actual; - } - return null; + DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); + String actual = fmt.format(toNumber(tuple.format)); + String expected = tuple.output; + if (!expected.equals(actual)) { + return "Expected " + expected + ", got " + actual; + } + return null; } @Override public String toPattern(DataDrivenNumberFormatTestData tuple) { - DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); - StringBuilder result = new StringBuilder(); - if (tuple.toPattern != null) { - String expected = tuple.toPattern; - String actual = fmt.toPattern(); - if (!expected.equals(actual)) { - result.append("Expected toPattern=" + expected + ", got " + actual); + DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); + StringBuilder result = new StringBuilder(); + if (tuple.toPattern != null) { + String expected = tuple.toPattern; + String actual = fmt.toPattern(); + if (!expected.equals(actual)) { + result.append("Expected toPattern=" + expected + ", got " + actual); + } } - } - if (tuple.toLocalizedPattern != null) { - String expected = tuple.toLocalizedPattern; - String actual = fmt.toLocalizedPattern(); - if (!expected.equals(actual)) { - result.append("Expected toLocalizedPattern=" + expected + ", got " + actual); + if (tuple.toLocalizedPattern != null) { + String expected = tuple.toLocalizedPattern; + String actual = fmt.toLocalizedPattern(); + if (!expected.equals(actual)) { + result.append("Expected toLocalizedPattern=" + expected + ", got " + actual); + } } - } - return result.length() == 0 ? null : result.toString(); + return result.length() == 0 ? null : result.toString(); } @Override public String parse(DataDrivenNumberFormatTestData tuple) { - DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); - ParsePosition ppos = new ParsePosition(0); - Number actual = fmt.parse(tuple.parse, ppos); - if (ppos.getIndex() == 0) { - return "Parse failed; got " + actual + ", but expected " + tuple.output; - } - if (tuple.output.equals("fail")) { + DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); + ParsePosition ppos = new ParsePosition(0); + Number actual = fmt.parse(tuple.parse, ppos); + if (ppos.getIndex() == 0) { + return "Parse failed; got " + actual + ", but expected " + tuple.output; + } + if (tuple.output.equals("fail")) { + return null; + } + Number expected = toNumber(tuple.output); + // number types cannot be compared, this is the best we can do. + if (expected.doubleValue() != actual.doubleValue() + && !Double.isNaN(expected.doubleValue()) + && !Double.isNaN(expected.doubleValue())) { + return "Expected: " + expected + ", got: " + actual; + } return null; - } - Number expected = toNumber(tuple.output); - // number types cannot be compared, this is the best we can do. - if (expected.doubleValue() != actual.doubleValue() - && !Double.isNaN(expected.doubleValue()) - && !Double.isNaN(expected.doubleValue())) { - return "Expected: " + expected + ", got: " + actual; - } - return null; } @Override public String parseCurrency(DataDrivenNumberFormatTestData tuple) { - DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); - ParsePosition ppos = new ParsePosition(0); - CurrencyAmount currAmt = fmt.parseCurrency(tuple.parse, ppos); - if (ppos.getIndex() == 0) { - return "Parse failed; got " + currAmt + ", but expected " + tuple.output; - } - if (tuple.output.equals("fail")) { + DecimalFormat_ICU58 fmt = createDecimalFormat(tuple); + ParsePosition ppos = new ParsePosition(0); + CurrencyAmount currAmt = fmt.parseCurrency(tuple.parse, ppos); + if (ppos.getIndex() == 0) { + return "Parse failed; got " + currAmt + ", but expected " + tuple.output; + } + if (tuple.output.equals("fail")) { + return null; + } + Number expected = toNumber(tuple.output); + Number actual = currAmt.getNumber(); + // number types cannot be compared, this is the best we can do. + if (expected.doubleValue() != actual.doubleValue() + && !Double.isNaN(expected.doubleValue()) + && !Double.isNaN(expected.doubleValue())) { + return "Expected: " + expected + ", got: " + actual; + } + + if (!tuple.outputCurrency.equals(currAmt.getCurrency().toString())) { + return "Expected currency: " + tuple.outputCurrency + ", got: " + currAmt.getCurrency(); + } return null; - } - Number expected = toNumber(tuple.output); - Number actual = currAmt.getNumber(); - // number types cannot be compared, this is the best we can do. - if (expected.doubleValue() != actual.doubleValue() - && !Double.isNaN(expected.doubleValue()) - && !Double.isNaN(expected.doubleValue())) { - return "Expected: " + expected + ", got: " + actual; - } - - if (!tuple.outputCurrency.equals(currAmt.getCurrency().toString())) { - return "Expected currency: " + tuple.outputCurrency + ", got: " + currAmt.getCurrency(); - } - return null; } /** @@ -131,181 +130,179 @@ public class NumberFormatDataDrivenTest { */ private DecimalFormat_ICU58 createDecimalFormat(DataDrivenNumberFormatTestData tuple) { - DecimalFormat_ICU58 fmt = - new DecimalFormat_ICU58( - tuple.pattern == null ? "0" : tuple.pattern, - new DecimalFormatSymbols(tuple.locale == null ? EN : tuple.locale)); - adjustDecimalFormat(tuple, fmt); - return fmt; + DecimalFormat_ICU58 fmt = new DecimalFormat_ICU58( + tuple.pattern == null ? "0" : tuple.pattern, + new DecimalFormatSymbols(tuple.locale == null ? EN : tuple.locale)); + adjustDecimalFormat(tuple, fmt); + return fmt; } + /** * @param tuple * @param fmt */ - private void adjustDecimalFormat( - DataDrivenNumberFormatTestData tuple, DecimalFormat_ICU58 fmt) { - if (tuple.minIntegerDigits != null) { - fmt.setMinimumIntegerDigits(tuple.minIntegerDigits); - } - if (tuple.maxIntegerDigits != null) { - fmt.setMaximumIntegerDigits(tuple.maxIntegerDigits); - } - if (tuple.minFractionDigits != null) { - fmt.setMinimumFractionDigits(tuple.minFractionDigits); - } - if (tuple.maxFractionDigits != null) { - fmt.setMaximumFractionDigits(tuple.maxFractionDigits); - } - if (tuple.currency != null) { - fmt.setCurrency(tuple.currency); - } - if (tuple.minGroupingDigits != null) { - // Oops we don't support this. - } - if (tuple.useSigDigits != null) { - fmt.setSignificantDigitsUsed(tuple.useSigDigits != 0); - } - if (tuple.minSigDigits != null) { - fmt.setMinimumSignificantDigits(tuple.minSigDigits); - } - if (tuple.maxSigDigits != null) { - fmt.setMaximumSignificantDigits(tuple.maxSigDigits); - } - if (tuple.useGrouping != null) { - fmt.setGroupingUsed(tuple.useGrouping != 0); - } - if (tuple.multiplier != null) { - fmt.setMultiplier(tuple.multiplier); - } - if (tuple.roundingIncrement != null) { - fmt.setRoundingIncrement(tuple.roundingIncrement.doubleValue()); - } - if (tuple.formatWidth != null) { - fmt.setFormatWidth(tuple.formatWidth); - } - if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { - fmt.setPadCharacter(tuple.padCharacter.charAt(0)); - } - if (tuple.useScientific != null) { - fmt.setScientificNotation(tuple.useScientific != 0); - } - if (tuple.grouping != null) { - fmt.setGroupingSize(tuple.grouping); - } - if (tuple.grouping2 != null) { - fmt.setSecondaryGroupingSize(tuple.grouping2); - } - if (tuple.roundingMode != null) { - fmt.setRoundingMode(tuple.roundingMode); - } - if (tuple.currencyUsage != null) { - fmt.setCurrencyUsage(tuple.currencyUsage); - } - if (tuple.minimumExponentDigits != null) { - fmt.setMinimumExponentDigits(tuple.minimumExponentDigits.byteValue()); - } - if (tuple.exponentSignAlwaysShown != null) { - fmt.setExponentSignAlwaysShown(tuple.exponentSignAlwaysShown != 0); - } - if (tuple.decimalSeparatorAlwaysShown != null) { - fmt.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); - } - if (tuple.padPosition != null) { - fmt.setPadPosition(tuple.padPosition); - } - if (tuple.positivePrefix != null) { - fmt.setPositivePrefix(tuple.positivePrefix); - } - if (tuple.positiveSuffix != null) { - fmt.setPositiveSuffix(tuple.positiveSuffix); - } - if (tuple.negativePrefix != null) { - fmt.setNegativePrefix(tuple.negativePrefix); - } - if (tuple.negativeSuffix != null) { - fmt.setNegativeSuffix(tuple.negativeSuffix); - } - if (tuple.signAlwaysShown != null) { - // Not supported. - } - if (tuple.localizedPattern != null) { - fmt.applyLocalizedPattern(tuple.localizedPattern); - } - int lenient = tuple.lenient == null ? 1 : tuple.lenient.intValue(); - fmt.setParseStrict(lenient == 0); - if (tuple.parseIntegerOnly != null) { - fmt.setParseIntegerOnly(tuple.parseIntegerOnly != 0); - } - if (tuple.parseCaseSensitive != null) { - // Not supported. - } - if (tuple.decimalPatternMatchRequired != null) { - fmt.setDecimalPatternMatchRequired(tuple.decimalPatternMatchRequired != 0); - } - if (tuple.parseNoExponent != null) { - // Oops, not supported for now - } - } - }; - - private DataDrivenNumberFormatTestUtility.CodeUnderTest JDK = - new DataDrivenNumberFormatTestUtility.CodeUnderTest() { + private void adjustDecimalFormat(DataDrivenNumberFormatTestData tuple, DecimalFormat_ICU58 fmt) { + if (tuple.minIntegerDigits != null) { + fmt.setMinimumIntegerDigits(tuple.minIntegerDigits); + } + if (tuple.maxIntegerDigits != null) { + fmt.setMaximumIntegerDigits(tuple.maxIntegerDigits); + } + if (tuple.minFractionDigits != null) { + fmt.setMinimumFractionDigits(tuple.minFractionDigits); + } + if (tuple.maxFractionDigits != null) { + fmt.setMaximumFractionDigits(tuple.maxFractionDigits); + } + if (tuple.currency != null) { + fmt.setCurrency(tuple.currency); + } + if (tuple.minGroupingDigits != null) { + // Oops we don't support this. + } + if (tuple.useSigDigits != null) { + fmt.setSignificantDigitsUsed(tuple.useSigDigits != 0); + } + if (tuple.minSigDigits != null) { + fmt.setMinimumSignificantDigits(tuple.minSigDigits); + } + if (tuple.maxSigDigits != null) { + fmt.setMaximumSignificantDigits(tuple.maxSigDigits); + } + if (tuple.useGrouping != null) { + fmt.setGroupingUsed(tuple.useGrouping != 0); + } + if (tuple.multiplier != null) { + fmt.setMultiplier(tuple.multiplier); + } + if (tuple.roundingIncrement != null) { + fmt.setRoundingIncrement(tuple.roundingIncrement.doubleValue()); + } + if (tuple.formatWidth != null) { + fmt.setFormatWidth(tuple.formatWidth); + } + if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { + fmt.setPadCharacter(tuple.padCharacter.charAt(0)); + } + if (tuple.useScientific != null) { + fmt.setScientificNotation(tuple.useScientific != 0); + } + if (tuple.grouping != null) { + fmt.setGroupingSize(tuple.grouping); + } + if (tuple.grouping2 != null) { + fmt.setSecondaryGroupingSize(tuple.grouping2); + } + if (tuple.roundingMode != null) { + fmt.setRoundingMode(tuple.roundingMode); + } + if (tuple.currencyUsage != null) { + fmt.setCurrencyUsage(tuple.currencyUsage); + } + if (tuple.minimumExponentDigits != null) { + fmt.setMinimumExponentDigits(tuple.minimumExponentDigits.byteValue()); + } + if (tuple.exponentSignAlwaysShown != null) { + fmt.setExponentSignAlwaysShown(tuple.exponentSignAlwaysShown != 0); + } + if (tuple.decimalSeparatorAlwaysShown != null) { + fmt.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); + } + if (tuple.padPosition != null) { + fmt.setPadPosition(tuple.padPosition); + } + if (tuple.positivePrefix != null) { + fmt.setPositivePrefix(tuple.positivePrefix); + } + if (tuple.positiveSuffix != null) { + fmt.setPositiveSuffix(tuple.positiveSuffix); + } + if (tuple.negativePrefix != null) { + fmt.setNegativePrefix(tuple.negativePrefix); + } + if (tuple.negativeSuffix != null) { + fmt.setNegativeSuffix(tuple.negativeSuffix); + } + if (tuple.signAlwaysShown != null) { + // Not supported. + } + if (tuple.localizedPattern != null) { + fmt.applyLocalizedPattern(tuple.localizedPattern); + } + int lenient = tuple.lenient == null ? 1 : tuple.lenient.intValue(); + fmt.setParseStrict(lenient == 0); + if (tuple.parseIntegerOnly != null) { + fmt.setParseIntegerOnly(tuple.parseIntegerOnly != 0); + } + if (tuple.parseCaseSensitive != null) { + // Not supported. + } + if (tuple.decimalPatternMatchRequired != null) { + fmt.setDecimalPatternMatchRequired(tuple.decimalPatternMatchRequired != 0); + } + if (tuple.parseNoExponent != null) { + // Oops, not supported for now + } + } + }; + + private DataDrivenNumberFormatTestUtility.CodeUnderTest JDK = new DataDrivenNumberFormatTestUtility.CodeUnderTest() { @Override public Character Id() { - return 'K'; + return 'K'; } @Override public String format(DataDrivenNumberFormatTestData tuple) { - java.text.DecimalFormat fmt = createDecimalFormat(tuple); - String actual = fmt.format(toNumber(tuple.format)); - String expected = tuple.output; - if (!expected.equals(actual)) { - return "Expected " + expected + ", got " + actual; - } - return null; + java.text.DecimalFormat fmt = createDecimalFormat(tuple); + String actual = fmt.format(toNumber(tuple.format)); + String expected = tuple.output; + if (!expected.equals(actual)) { + return "Expected " + expected + ", got " + actual; + } + return null; } @Override public String toPattern(DataDrivenNumberFormatTestData tuple) { - java.text.DecimalFormat fmt = createDecimalFormat(tuple); - StringBuilder result = new StringBuilder(); - if (tuple.toPattern != null) { - String expected = tuple.toPattern; - String actual = fmt.toPattern(); - if (!expected.equals(actual)) { - result.append("Expected toPattern=" + expected + ", got " + actual); + java.text.DecimalFormat fmt = createDecimalFormat(tuple); + StringBuilder result = new StringBuilder(); + if (tuple.toPattern != null) { + String expected = tuple.toPattern; + String actual = fmt.toPattern(); + if (!expected.equals(actual)) { + result.append("Expected toPattern=" + expected + ", got " + actual); + } } - } - if (tuple.toLocalizedPattern != null) { - String expected = tuple.toLocalizedPattern; - String actual = fmt.toLocalizedPattern(); - if (!expected.equals(actual)) { - result.append("Expected toLocalizedPattern=" + expected + ", got " + actual); + if (tuple.toLocalizedPattern != null) { + String expected = tuple.toLocalizedPattern; + String actual = fmt.toLocalizedPattern(); + if (!expected.equals(actual)) { + result.append("Expected toLocalizedPattern=" + expected + ", got " + actual); + } } - } - return result.length() == 0 ? null : result.toString(); + return result.length() == 0 ? null : result.toString(); } @Override public String parse(DataDrivenNumberFormatTestData tuple) { - java.text.DecimalFormat fmt = createDecimalFormat(tuple); - ParsePosition ppos = new ParsePosition(0); - Number actual = fmt.parse(tuple.parse, ppos); - if (ppos.getIndex() == 0) { - return "Parse failed; got " + actual + ", but expected " + tuple.output; - } - if (tuple.output.equals("fail")) { + java.text.DecimalFormat fmt = createDecimalFormat(tuple); + ParsePosition ppos = new ParsePosition(0); + Number actual = fmt.parse(tuple.parse, ppos); + if (ppos.getIndex() == 0) { + return "Parse failed; got " + actual + ", but expected " + tuple.output; + } + if (tuple.output.equals("fail")) { + return null; + } + Number expected = toNumber(tuple.output); + // number types cannot be compared, this is the best we can do. + if (expected.doubleValue() != actual.doubleValue() + && !Double.isNaN(expected.doubleValue()) + && !Double.isNaN(expected.doubleValue())) { + return "Expected: " + expected + ", got: " + actual; + } return null; - } - Number expected = toNumber(tuple.output); - // number types cannot be compared, this is the best we can do. - if (expected.doubleValue() != actual.doubleValue() - && !Double.isNaN(expected.doubleValue()) - && !Double.isNaN(expected.doubleValue())) { - return "Expected: " + expected + ", got: " + actual; - } - return null; } /** @@ -313,13 +310,12 @@ public class NumberFormatDataDrivenTest { * @return */ private java.text.DecimalFormat createDecimalFormat(DataDrivenNumberFormatTestData tuple) { - java.text.DecimalFormat fmt = - new java.text.DecimalFormat( - tuple.pattern == null ? "0" : tuple.pattern, - new java.text.DecimalFormatSymbols( - (tuple.locale == null ? EN : tuple.locale).toLocale())); - adjustDecimalFormat(tuple, fmt); - return fmt; + java.text.DecimalFormat fmt = new java.text.DecimalFormat( + tuple.pattern == null ? "0" : tuple.pattern, + new java.text.DecimalFormatSymbols( + (tuple.locale == null ? EN : tuple.locale).toLocale())); + adjustDecimalFormat(tuple, fmt); + return fmt; } /** @@ -327,370 +323,370 @@ public class NumberFormatDataDrivenTest { * @param fmt */ private void adjustDecimalFormat( - DataDrivenNumberFormatTestData tuple, java.text.DecimalFormat fmt) { - if (tuple.minIntegerDigits != null) { - fmt.setMinimumIntegerDigits(tuple.minIntegerDigits); - } - if (tuple.maxIntegerDigits != null) { - fmt.setMaximumIntegerDigits(tuple.maxIntegerDigits); - } - if (tuple.minFractionDigits != null) { - fmt.setMinimumFractionDigits(tuple.minFractionDigits); - } - if (tuple.maxFractionDigits != null) { - fmt.setMaximumFractionDigits(tuple.maxFractionDigits); - } - if (tuple.currency != null) { - fmt.setCurrency(java.util.Currency.getInstance(tuple.currency.toString())); - } - if (tuple.minGroupingDigits != null) { - // Oops we don't support this. - } - if (tuple.useSigDigits != null) { - // Oops we don't support this - } - if (tuple.minSigDigits != null) { - // Oops we don't support this - } - if (tuple.maxSigDigits != null) { - // Oops we don't support this - } - if (tuple.useGrouping != null) { - fmt.setGroupingUsed(tuple.useGrouping != 0); - } - if (tuple.multiplier != null) { - fmt.setMultiplier(tuple.multiplier); - } - if (tuple.roundingIncrement != null) { - // Not supported - } - if (tuple.formatWidth != null) { - // Not supported - } - if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { - // Not supported - } - if (tuple.useScientific != null) { - // Not supported - } - if (tuple.grouping != null) { - fmt.setGroupingSize(tuple.grouping); - } - if (tuple.grouping2 != null) { - // Not supported - } - if (tuple.roundingMode != null) { - // Not supported - } - if (tuple.currencyUsage != null) { - // Not supported - } - if (tuple.minimumExponentDigits != null) { - // Not supported - } - if (tuple.exponentSignAlwaysShown != null) { - // Not supported - } - if (tuple.decimalSeparatorAlwaysShown != null) { - fmt.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); - } - if (tuple.padPosition != null) { - // Not supported - } - if (tuple.positivePrefix != null) { - fmt.setPositivePrefix(tuple.positivePrefix); - } - if (tuple.positiveSuffix != null) { - fmt.setPositiveSuffix(tuple.positiveSuffix); - } - if (tuple.negativePrefix != null) { - fmt.setNegativePrefix(tuple.negativePrefix); - } - if (tuple.negativeSuffix != null) { - fmt.setNegativeSuffix(tuple.negativeSuffix); - } - if (tuple.signAlwaysShown != null) { - // Not supported. - } - if (tuple.localizedPattern != null) { - fmt.applyLocalizedPattern(tuple.localizedPattern); - } - - // lenient parsing not supported by JDK - if (tuple.parseIntegerOnly != null) { - fmt.setParseIntegerOnly(tuple.parseIntegerOnly != 0); - } - if (tuple.parseCaseSensitive != null) { - // Not supported. - } - if (tuple.decimalPatternMatchRequired != null) { - // Oops, not supported - } - if (tuple.parseNoExponent != null) { - // Oops, not supported for now - } - } - }; - - static void propertiesFromTuple(DataDrivenNumberFormatTestData tuple, DecimalFormatProperties properties) { - if (tuple.minIntegerDigits != null) { - properties.setMinimumIntegerDigits(tuple.minIntegerDigits); - } - if (tuple.maxIntegerDigits != null) { - properties.setMaximumIntegerDigits(tuple.maxIntegerDigits); - } - if (tuple.minFractionDigits != null) { - properties.setMinimumFractionDigits(tuple.minFractionDigits); - } - if (tuple.maxFractionDigits != null) { - properties.setMaximumFractionDigits(tuple.maxFractionDigits); - } - if (tuple.currency != null) { - properties.setCurrency(tuple.currency); - } - if (tuple.minGroupingDigits != null) { - properties.setMinimumGroupingDigits(tuple.minGroupingDigits); - } - if (tuple.useSigDigits != null) { - // TODO - } - if (tuple.minSigDigits != null) { - properties.setMinimumSignificantDigits(tuple.minSigDigits); - } - if (tuple.maxSigDigits != null) { - properties.setMaximumSignificantDigits(tuple.maxSigDigits); - } - if (tuple.useGrouping != null) { - properties.setGroupingUsed(tuple.useGrouping > 0); - } - if (tuple.multiplier != null) { - properties.setMultiplier(new BigDecimal(tuple.multiplier)); - } - if (tuple.roundingIncrement != null) { - properties.setRoundingIncrement(new BigDecimal(tuple.roundingIncrement.toString())); - } - if (tuple.formatWidth != null) { - properties.setFormatWidth(tuple.formatWidth); - } - if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { - properties.setPadString(tuple.padCharacter.toString()); - } - if (tuple.useScientific != null) { - properties.setMinimumExponentDigits( - tuple.useScientific != 0 ? 1 : -1); - } - if (tuple.grouping != null) { - properties.setGroupingSize(tuple.grouping); - } - if (tuple.grouping2 != null) { - properties.setSecondaryGroupingSize(tuple.grouping2); - } - if (tuple.roundingMode != null) { - properties.setRoundingMode(RoundingMode.valueOf(tuple.roundingMode)); - } - if (tuple.currencyUsage != null) { - properties.setCurrencyUsage(tuple.currencyUsage); - } - if (tuple.minimumExponentDigits != null) { - properties.setMinimumExponentDigits(tuple.minimumExponentDigits.byteValue()); - } - if (tuple.exponentSignAlwaysShown != null) { - properties.setExponentSignAlwaysShown(tuple.exponentSignAlwaysShown != 0); - } - if (tuple.decimalSeparatorAlwaysShown != null) { - properties.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); - } - if (tuple.padPosition != null) { - properties.setPadPosition(PadPosition.fromOld(tuple.padPosition)); - } - if (tuple.positivePrefix != null) { - properties.setPositivePrefix(tuple.positivePrefix); - } - if (tuple.positiveSuffix != null) { - properties.setPositiveSuffix(tuple.positiveSuffix); - } - if (tuple.negativePrefix != null) { - properties.setNegativePrefix(tuple.negativePrefix); - } - if (tuple.negativeSuffix != null) { - properties.setNegativeSuffix(tuple.negativeSuffix); - } - if (tuple.signAlwaysShown != null) { - properties.setSignAlwaysShown(tuple.signAlwaysShown != 0); - } - if (tuple.localizedPattern != null) { - DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(tuple.locale); - String converted = PatternStringUtils.convertLocalized(tuple.localizedPattern, symbols, false); - PatternStringParser.parseToExistingProperties(converted, properties); - } - if (tuple.lenient != null) { - properties.setParseMode(tuple.lenient == 0 ? ParseMode.STRICT : ParseMode.LENIENT); - } - if (tuple.parseIntegerOnly != null) { - properties.setParseIntegerOnly(tuple.parseIntegerOnly != 0); - } - if (tuple.parseCaseSensitive != null) { - properties.setParseCaseSensitive(tuple.parseCaseSensitive != 0); - } - if (tuple.decimalPatternMatchRequired != null) { - properties.setDecimalPatternMatchRequired(tuple.decimalPatternMatchRequired != 0); - } - if (tuple.parseNoExponent != null) { - properties.setParseNoExponent(tuple.parseNoExponent != 0); + DataDrivenNumberFormatTestData tuple, + java.text.DecimalFormat fmt) { + if (tuple.minIntegerDigits != null) { + fmt.setMinimumIntegerDigits(tuple.minIntegerDigits); + } + if (tuple.maxIntegerDigits != null) { + fmt.setMaximumIntegerDigits(tuple.maxIntegerDigits); + } + if (tuple.minFractionDigits != null) { + fmt.setMinimumFractionDigits(tuple.minFractionDigits); + } + if (tuple.maxFractionDigits != null) { + fmt.setMaximumFractionDigits(tuple.maxFractionDigits); + } + if (tuple.currency != null) { + fmt.setCurrency(java.util.Currency.getInstance(tuple.currency.toString())); + } + if (tuple.minGroupingDigits != null) { + // Oops we don't support this. + } + if (tuple.useSigDigits != null) { + // Oops we don't support this + } + if (tuple.minSigDigits != null) { + // Oops we don't support this + } + if (tuple.maxSigDigits != null) { + // Oops we don't support this + } + if (tuple.useGrouping != null) { + fmt.setGroupingUsed(tuple.useGrouping != 0); + } + if (tuple.multiplier != null) { + fmt.setMultiplier(tuple.multiplier); + } + if (tuple.roundingIncrement != null) { + // Not supported + } + if (tuple.formatWidth != null) { + // Not supported + } + if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { + // Not supported + } + if (tuple.useScientific != null) { + // Not supported + } + if (tuple.grouping != null) { + fmt.setGroupingSize(tuple.grouping); + } + if (tuple.grouping2 != null) { + // Not supported + } + if (tuple.roundingMode != null) { + // Not supported + } + if (tuple.currencyUsage != null) { + // Not supported + } + if (tuple.minimumExponentDigits != null) { + // Not supported + } + if (tuple.exponentSignAlwaysShown != null) { + // Not supported + } + if (tuple.decimalSeparatorAlwaysShown != null) { + fmt.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); + } + if (tuple.padPosition != null) { + // Not supported + } + if (tuple.positivePrefix != null) { + fmt.setPositivePrefix(tuple.positivePrefix); + } + if (tuple.positiveSuffix != null) { + fmt.setPositiveSuffix(tuple.positiveSuffix); + } + if (tuple.negativePrefix != null) { + fmt.setNegativePrefix(tuple.negativePrefix); + } + if (tuple.negativeSuffix != null) { + fmt.setNegativeSuffix(tuple.negativeSuffix); + } + if (tuple.signAlwaysShown != null) { + // Not supported. + } + if (tuple.localizedPattern != null) { + fmt.applyLocalizedPattern(tuple.localizedPattern); + } + + // lenient parsing not supported by JDK + if (tuple.parseIntegerOnly != null) { + fmt.setParseIntegerOnly(tuple.parseIntegerOnly != 0); + } + if (tuple.parseCaseSensitive != null) { + // Not supported. + } + if (tuple.decimalPatternMatchRequired != null) { + // Oops, not supported + } + if (tuple.parseNoExponent != null) { + // Oops, not supported for now + } + } + }; + + static void propertiesFromTuple( + DataDrivenNumberFormatTestData tuple, + DecimalFormatProperties properties) { + if (tuple.minIntegerDigits != null) { + properties.setMinimumIntegerDigits(tuple.minIntegerDigits); + } + if (tuple.maxIntegerDigits != null) { + properties.setMaximumIntegerDigits(tuple.maxIntegerDigits); + } + if (tuple.minFractionDigits != null) { + properties.setMinimumFractionDigits(tuple.minFractionDigits); + } + if (tuple.maxFractionDigits != null) { + properties.setMaximumFractionDigits(tuple.maxFractionDigits); + } + if (tuple.currency != null) { + properties.setCurrency(tuple.currency); + } + if (tuple.minGroupingDigits != null) { + properties.setMinimumGroupingDigits(tuple.minGroupingDigits); + } + if (tuple.useSigDigits != null) { + // TODO + } + if (tuple.minSigDigits != null) { + properties.setMinimumSignificantDigits(tuple.minSigDigits); + } + if (tuple.maxSigDigits != null) { + properties.setMaximumSignificantDigits(tuple.maxSigDigits); + } + if (tuple.useGrouping != null) { + properties.setGroupingUsed(tuple.useGrouping > 0); + } + if (tuple.multiplier != null) { + properties.setMultiplier(new BigDecimal(tuple.multiplier)); + } + if (tuple.roundingIncrement != null) { + properties.setRoundingIncrement(new BigDecimal(tuple.roundingIncrement.toString())); + } + if (tuple.formatWidth != null) { + properties.setFormatWidth(tuple.formatWidth); + } + if (tuple.padCharacter != null && tuple.padCharacter.length() > 0) { + properties.setPadString(tuple.padCharacter.toString()); + } + if (tuple.useScientific != null) { + properties.setMinimumExponentDigits(tuple.useScientific != 0 ? 1 : -1); + } + if (tuple.grouping != null) { + properties.setGroupingSize(tuple.grouping); + } + if (tuple.grouping2 != null) { + properties.setSecondaryGroupingSize(tuple.grouping2); + } + if (tuple.roundingMode != null) { + properties.setRoundingMode(RoundingMode.valueOf(tuple.roundingMode)); + } + if (tuple.currencyUsage != null) { + properties.setCurrencyUsage(tuple.currencyUsage); + } + if (tuple.minimumExponentDigits != null) { + properties.setMinimumExponentDigits(tuple.minimumExponentDigits.byteValue()); + } + if (tuple.exponentSignAlwaysShown != null) { + properties.setExponentSignAlwaysShown(tuple.exponentSignAlwaysShown != 0); + } + if (tuple.decimalSeparatorAlwaysShown != null) { + properties.setDecimalSeparatorAlwaysShown(tuple.decimalSeparatorAlwaysShown != 0); + } + if (tuple.padPosition != null) { + properties.setPadPosition(PadPosition.fromOld(tuple.padPosition)); + } + if (tuple.positivePrefix != null) { + properties.setPositivePrefix(tuple.positivePrefix); + } + if (tuple.positiveSuffix != null) { + properties.setPositiveSuffix(tuple.positiveSuffix); + } + if (tuple.negativePrefix != null) { + properties.setNegativePrefix(tuple.negativePrefix); + } + if (tuple.negativeSuffix != null) { + properties.setNegativeSuffix(tuple.negativeSuffix); + } + if (tuple.signAlwaysShown != null) { + properties.setSignAlwaysShown(tuple.signAlwaysShown != 0); + } + if (tuple.localizedPattern != null) { + DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(tuple.locale); + String converted = PatternStringUtils + .convertLocalized(tuple.localizedPattern, symbols, false); + PatternStringParser.parseToExistingProperties(converted, properties); + } + if (tuple.lenient != null) { + properties.setParseMode(tuple.lenient == 0 ? ParseMode.STRICT : ParseMode.LENIENT); + } + if (tuple.parseIntegerOnly != null) { + properties.setParseIntegerOnly(tuple.parseIntegerOnly != 0); + } + if (tuple.parseCaseSensitive != null) { + properties.setParseCaseSensitive(tuple.parseCaseSensitive != 0); + } + if (tuple.decimalPatternMatchRequired != null) { + properties.setDecimalPatternMatchRequired(tuple.decimalPatternMatchRequired != 0); + } + if (tuple.parseNoExponent != null) { + properties.setParseNoExponent(tuple.parseNoExponent != 0); + } } - } - /** - * Formatting, but no other features. - */ - private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU60 = - new DataDrivenNumberFormatTestUtility.CodeUnderTest() { + /** + * Formatting, but no other features. + */ + private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU60 = new DataDrivenNumberFormatTestUtility.CodeUnderTest() { @Override public Character Id() { - return 'Q'; + return 'Q'; } /** - * Runs a single formatting test. On success, returns null. On failure, returns the error. - * This implementation just returns null. Subclasses should override. + * Runs a single formatting test. On success, returns null. On failure, returns the error. This + * implementation just returns null. Subclasses should override. * - * @param tuple contains the parameters of the format test. + * @param tuple + * contains the parameters of the format test. */ @Override public String format(DataDrivenNumberFormatTestData tuple) { - String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; - ULocale locale = (tuple.locale == null) ? ULocale.ENGLISH : tuple.locale; - DecimalFormatProperties properties = - PatternStringParser.parseToProperties( - pattern, - tuple.currency != null - ? PatternStringParser.IGNORE_ROUNDING_ALWAYS - : PatternStringParser.IGNORE_ROUNDING_NEVER); - propertiesFromTuple(tuple, properties); - DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); - LocalizedNumberFormatter fmt = NumberFormatter.fromDecimalFormat(properties, symbols, null).locale(locale); - Number number = toNumber(tuple.format); - String expected = tuple.output; - String actual = fmt.format(number).toString(); - if (!expected.equals(actual)) { - return "Expected \"" + expected + "\", got \"" + actual + "\""; - } - return null; - } - }; - - /** - * Parsing, but no other features. - */ - private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU61_Parsing = - new DataDrivenNumberFormatTestUtility.CodeUnderTest() { - - @Override - public Character Id() { - return 'P'; - } - - @Override - public String parse(DataDrivenNumberFormatTestData tuple) { - String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; - DecimalFormatProperties properties; - ParsePosition ppos = new ParsePosition(0); - Number actual; - try { - properties = PatternStringParser.parseToProperties(pattern, - tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS - : PatternStringParser.IGNORE_ROUNDING_NEVER); - propertiesFromTuple(tuple, properties); - actual = NumberParserImpl.parseStatic(tuple.parse, - ppos, - properties, - DecimalFormatSymbols.getInstance(tuple.locale)); - } catch (IllegalArgumentException e) { - return "parse exception: " + e.getMessage(); - } - if (actual == null && ppos.getIndex() != 0) { - throw new AssertionError("Error: value is null but parse position is not zero"); - } - if (ppos.getIndex() == 0) { - return "Parse failed; got " + actual + ", but expected " + tuple.output; - } - if (tuple.output.equals("NaN")) { - if (!Double.isNaN(actual.doubleValue())) { - return "Expected NaN, but got: " + actual; - } - return null; - } else if (tuple.output.equals("Inf")) { - if (!Double.isInfinite(actual.doubleValue()) || Double.compare(actual.doubleValue(), 0.0) < 0) { - return "Expected Inf, but got: " + actual; - } - return null; - } else if (tuple.output.equals("-Inf")) { - if (!Double.isInfinite(actual.doubleValue()) || Double.compare(actual.doubleValue(), 0.0) > 0) { - return "Expected -Inf, but got: " + actual; - } - return null; - } else if (tuple.output.equals("fail")) { - return null; - } else if (new BigDecimal(tuple.output).compareTo(new BigDecimal(actual.toString())) != 0) { - return "Expected: " + tuple.output + ", got: " + actual; - } else { - return null; - } + String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; + ULocale locale = (tuple.locale == null) ? ULocale.ENGLISH : tuple.locale; + DecimalFormatProperties properties = PatternStringParser.parseToProperties(pattern, + tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS + : PatternStringParser.IGNORE_ROUNDING_NEVER); + propertiesFromTuple(tuple, properties); + DecimalFormatSymbols symbols = DecimalFormatSymbols.getInstance(locale); + LocalizedNumberFormatter fmt = NumberFormatter.fromDecimalFormat(properties, symbols, null) + .locale(locale); + Number number = toNumber(tuple.format); + String expected = tuple.output; + String actual = fmt.format(number).toString(); + if (!expected.equals(actual)) { + return "Expected \"" + expected + "\", got \"" + actual + "\""; } + return null; + } + }; - @Override - public String parseCurrency(DataDrivenNumberFormatTestData tuple) { - String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; - DecimalFormatProperties properties; - ParsePosition ppos = new ParsePosition(0); - CurrencyAmount actual; - try { - properties = PatternStringParser.parseToProperties( - pattern, - tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS - : PatternStringParser.IGNORE_ROUNDING_NEVER); - propertiesFromTuple(tuple, properties); - actual = NumberParserImpl.parseStaticCurrency(tuple.parse, - ppos, - properties, - DecimalFormatSymbols.getInstance(tuple.locale)); - } catch (IllegalArgumentException e) { - e.printStackTrace(); - return "parse exception: " + e.getMessage(); - } - if (ppos.getIndex() == 0 || actual.getCurrency().getCurrencyCode().equals("XXX")) { - return "Parse failed; got " + actual + ", but expected " + tuple.output; - } - if (tuple.output.equals("fail")) { - return null; + /** + * Parsing, but no other features. + */ + private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU61_Parsing = new DataDrivenNumberFormatTestUtility.CodeUnderTest() { + + @Override + public Character Id() { + return 'P'; + } + + @Override + public String parse(DataDrivenNumberFormatTestData tuple) { + String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; + DecimalFormatProperties properties; + ParsePosition ppos = new ParsePosition(0); + Number actual; + try { + properties = PatternStringParser.parseToProperties(pattern, + tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS + : PatternStringParser.IGNORE_ROUNDING_NEVER); + propertiesFromTuple(tuple, properties); + actual = NumberParserImpl.parseStatic(tuple.parse, + ppos, + properties, + DecimalFormatSymbols.getInstance(tuple.locale)); + } catch (IllegalArgumentException e) { + return "parse exception: " + e.getMessage(); + } + if (actual == null && ppos.getIndex() != 0) { + throw new AssertionError("Error: value is null but parse position is not zero"); + } + if (ppos.getIndex() == 0) { + return "Parse failed; got " + actual + ", but expected " + tuple.output; + } + if (tuple.output.equals("NaN")) { + if (!Double.isNaN(actual.doubleValue())) { + return "Expected NaN, but got: " + actual; } - BigDecimal expectedNumber = new BigDecimal(tuple.output); - if (expectedNumber.compareTo(new BigDecimal(actual.getNumber().toString())) != 0) { - return "Wrong number: Expected: " + expectedNumber + ", got: " + actual; + return null; + } else if (tuple.output.equals("Inf")) { + if (!Double.isInfinite(actual.doubleValue()) + || Double.compare(actual.doubleValue(), 0.0) < 0) { + return "Expected Inf, but got: " + actual; } - String expectedCurrency = tuple.outputCurrency; - if (!expectedCurrency.equals(actual.getCurrency().toString())) { - return "Wrong currency: Expected: " + expectedCurrency + ", got: " + actual; + return null; + } else if (tuple.output.equals("-Inf")) { + if (!Double.isInfinite(actual.doubleValue()) + || Double.compare(actual.doubleValue(), 0.0) > 0) { + return "Expected -Inf, but got: " + actual; } return null; + } else if (tuple.output.equals("fail")) { + return null; + } else if (new BigDecimal(tuple.output).compareTo(new BigDecimal(actual.toString())) != 0) { + return "Expected: " + tuple.output + ", got: " + actual; + } else { + return null; } - }; + } + + @Override + public String parseCurrency(DataDrivenNumberFormatTestData tuple) { + String pattern = (tuple.pattern == null) ? "0" : tuple.pattern; + DecimalFormatProperties properties; + ParsePosition ppos = new ParsePosition(0); + CurrencyAmount actual; + try { + properties = PatternStringParser.parseToProperties(pattern, + tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS + : PatternStringParser.IGNORE_ROUNDING_NEVER); + propertiesFromTuple(tuple, properties); + actual = NumberParserImpl.parseStaticCurrency(tuple.parse, + ppos, + properties, + DecimalFormatSymbols.getInstance(tuple.locale)); + } catch (IllegalArgumentException e) { + e.printStackTrace(); + return "parse exception: " + e.getMessage(); + } + if (ppos.getIndex() == 0 || actual.getCurrency().getCurrencyCode().equals("XXX")) { + return "Parse failed; got " + actual + ", but expected " + tuple.output; + } + if (tuple.output.equals("fail")) { + return null; + } + BigDecimal expectedNumber = new BigDecimal(tuple.output); + if (expectedNumber.compareTo(new BigDecimal(actual.getNumber().toString())) != 0) { + return "Wrong number: Expected: " + expectedNumber + ", got: " + actual; + } + String expectedCurrency = tuple.outputCurrency; + if (!expectedCurrency.equals(actual.getCurrency().toString())) { + return "Wrong currency: Expected: " + expectedCurrency + ", got: " + actual; + } + return null; + } + }; /** * All features except formatting. */ - private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU59_Other = - new DataDrivenNumberFormatTestUtility.CodeUnderTest() { + private DataDrivenNumberFormatTestUtility.CodeUnderTest ICU59_Other = new DataDrivenNumberFormatTestUtility.CodeUnderTest() { @Override public Character Id() { - return 'S'; + return 'S'; } /** - * Runs a single toPattern test. On success, returns null. On failure, returns the error. This implementation - * just returns null. Subclasses should override. + * Runs a single toPattern test. On success, returns null. On failure, returns the error. This + * implementation just returns null. Subclasses should override. * * @param tuple * contains the parameters of the format test. @@ -701,12 +697,12 @@ public class NumberFormatDataDrivenTest { final DecimalFormatProperties properties; DecimalFormat df; try { - properties = PatternStringParser.parseToProperties( - pattern, + properties = PatternStringParser.parseToProperties(pattern, tuple.currency != null ? PatternStringParser.IGNORE_ROUNDING_ALWAYS : PatternStringParser.IGNORE_ROUNDING_NEVER); propertiesFromTuple(tuple, properties); - // TODO: Use PatternString.propertiesToString() directly. (How to deal with CurrencyUsage?) + // TODO: Use PatternString.propertiesToString() directly. (How to deal with + // CurrencyUsage?) df = new DecimalFormat(); df.setProperties(new PropertySetter() { @Override @@ -737,8 +733,8 @@ public class NumberFormatDataDrivenTest { } /** - * Runs a single select test. On success, returns null. On failure, returns the error. This implementation just - * returns null. Subclasses should override. + * Runs a single select test. On success, returns null. On failure, returns the error. This + * implementation just returns null. Subclasses should override. * * @param tuple * contains the parameters of the format test. @@ -749,42 +745,43 @@ public class NumberFormatDataDrivenTest { } }; - @Test - public void TestDataDrivenICU58() { - // Android can't access DecimalFormat_ICU58 for testing (ticket #13283). - if (TestUtil.getJavaVendor() == TestUtil.JavaVendor.Android) return; - - DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( - "numberformattestspecification.txt", ICU58); - } - - @Test - public void TestDataDrivenJDK() { - // #13373: Since not all JDK implementations are the same, test only whitelisted JDKs - // with known behavior. The JDK version should be occasionally updated. - org.junit.Assume.assumeTrue( - TestUtil.getJavaRuntimeName() == TestUtil.JavaRuntimeName.OpenJDK - && TestUtil.getJavaVersion() == 8); - - DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( - "numberformattestspecification.txt", JDK); - } - - @Test - public void TestDataDrivenICULatest_Format() { - DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( - "numberformattestspecification.txt", ICU60); - } - - @Test - public void TestDataDrivenICULatest_Parsing() { - DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( - "numberformattestspecification.txt", ICU61_Parsing); - } - - @Test - public void TestDataDrivenICULatest_Other() { - DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( - "numberformattestspecification.txt", ICU59_Other); - } + @Test + public void TestDataDrivenICU58() { + // Android can't access DecimalFormat_ICU58 for testing (ticket #13283). + if (TestUtil.getJavaVendor() == TestUtil.JavaVendor.Android) + return; + + DataDrivenNumberFormatTestUtility + .runFormatSuiteIncludingKnownFailures("numberformattestspecification.txt", ICU58); + } + + @Test + public void TestDataDrivenJDK() { + // #13373: Since not all JDK implementations are the same, test only whitelisted JDKs + // with known behavior. The JDK version should be occasionally updated. + org.junit.Assume.assumeTrue(TestUtil.getJavaRuntimeName() == TestUtil.JavaRuntimeName.OpenJDK + && TestUtil.getJavaVersion() == 8); + + DataDrivenNumberFormatTestUtility + .runFormatSuiteIncludingKnownFailures("numberformattestspecification.txt", JDK); + } + + @Test + public void TestDataDrivenICULatest_Format() { + DataDrivenNumberFormatTestUtility + .runFormatSuiteIncludingKnownFailures("numberformattestspecification.txt", ICU60); + } + + @Test + public void TestDataDrivenICULatest_Parsing() { + DataDrivenNumberFormatTestUtility.runFormatSuiteIncludingKnownFailures( + "numberformattestspecification.txt", + ICU61_Parsing); + } + + @Test + public void TestDataDrivenICULatest_Other() { + DataDrivenNumberFormatTestUtility + .runFormatSuiteIncludingKnownFailures("numberformattestspecification.txt", ICU59_Other); + } } -- 2.40.0