use of android.icu.util.MeasureUnit in project j2objc by google.
the class PluralRangesTest method TestFormatting.
@Test
public void TestFormatting() {
Object[][] tests = { { 0.0, 1.0, ULocale.FRANCE, FormatWidth.WIDE, MeasureUnit.FAHRENHEIT, "0–1 degré Fahrenheit" }, { 1.0, 2.0, ULocale.FRANCE, FormatWidth.WIDE, MeasureUnit.FAHRENHEIT, "1–2 degrés Fahrenheit" }, { 3.1, 4.25, ULocale.FRANCE, FormatWidth.SHORT, MeasureUnit.FAHRENHEIT, "3,1–4,25 °F" }, { 3.1, 4.25, ULocale.ENGLISH, FormatWidth.SHORT, MeasureUnit.FAHRENHEIT, "3.1–4.25°F" }, { 3.1, 4.25, ULocale.CHINESE, FormatWidth.WIDE, MeasureUnit.INCH, "3.1-4.25英寸" }, { 0.0, 1.0, ULocale.ENGLISH, FormatWidth.WIDE, MeasureUnit.INCH, "0–1 inches" }, { 0.0, 1.0, ULocale.ENGLISH, FormatWidth.NARROW, Currency.getInstance("EUR"), "€0.00–1.00" }, { 0.0, 1.0, ULocale.FRENCH, FormatWidth.NARROW, Currency.getInstance("EUR"), "0,00–1,00 €" }, { 0.0, 100.0, ULocale.FRENCH, FormatWidth.NARROW, Currency.getInstance("JPY"), "0–100\u00a0JPY" }, { 0.0, 1.0, ULocale.ENGLISH, FormatWidth.SHORT, Currency.getInstance("EUR"), "EUR0.00–1.00" }, { 0.0, 1.0, ULocale.FRENCH, FormatWidth.SHORT, Currency.getInstance("EUR"), "0,00–1,00\u00a0EUR" }, { 0.0, 100.0, ULocale.FRENCH, FormatWidth.SHORT, Currency.getInstance("JPY"), "0–100\u00a0JPY" }, { 0.0, 1.0, ULocale.ENGLISH, FormatWidth.WIDE, Currency.getInstance("EUR"), "0.00–1.00 euros" }, { 0.0, 1.0, ULocale.FRENCH, FormatWidth.WIDE, Currency.getInstance("EUR"), "0,00–1,00 euro" }, { 0.0, 2.0, ULocale.FRENCH, FormatWidth.WIDE, Currency.getInstance("EUR"), "0,00–2,00 euros" }, { 0.0, 100.0, ULocale.FRENCH, FormatWidth.WIDE, Currency.getInstance("JPY"), "0–100 yens japonais" } };
int i = 0;
for (Object[] test : tests) {
++i;
double low = (Double) test[0];
double high = (Double) test[1];
final ULocale locale = (ULocale) test[2];
final FormatWidth width = (FormatWidth) test[3];
final MeasureUnit unit = (MeasureUnit) test[4];
final Object expected = test[5];
MeasureFormat mf = MeasureFormat.getInstance(locale, width);
Object actual;
try {
actual = mf.formatMeasureRange(new Measure(low, unit), new Measure(high, unit));
} catch (Exception e) {
actual = e.getClass();
}
assertEquals(i + " Formatting unit", expected, actual);
}
}
Aggregations