use of android.icu.text.CompactDecimalFormat in project j2objc by google.
the class CompactDecimalFormatTest method checkLocale.
public void checkLocale(ULocale locale, CompactStyle style, Object[][] testData) {
CompactDecimalFormat cdf = getCDFInstance(locale, style);
checkCdf(locale + " (" + locale.getDisplayName(locale) + ") for ", cdf, testData);
}
use of android.icu.text.CompactDecimalFormat in project j2objc by google.
the class CompactDecimalFormatTest method TestBug12688.
@Test
public void TestBug12688() {
if (logKnownIssue("12688", "CDF fails for numbers less than 1 million in 'it'")) {
return;
}
CompactDecimalFormat cdf;
String result;
cdf = CompactDecimalFormat.getInstance(ULocale.forLanguageTag("it"), CompactStyle.SHORT);
result = cdf.format(new CurrencyAmount(123000, Currency.getInstance("EUR")));
assertEquals("CDF should correctly format 123000 with currency in 'it'", "120000 €", result);
}
use of android.icu.text.CompactDecimalFormat in project j2objc by google.
the class CompactDecimalFormatTest method checkCore.
private void checkCore(Map<String, String[][]> affixes, Map<String, String[]> currencyAffixes, long[] divisors, Object[][] testItems) {
Collection<String> debugCreationErrors = new LinkedHashSet();
CompactDecimalFormat cdf = new CompactDecimalFormat("#,###.00", DecimalFormatSymbols.getInstance(new ULocale("fr")), CompactStyle.SHORT, PluralRules.createRules("one: j is 1 or f is 1"), divisors, affixes, currencyAffixes, debugCreationErrors);
if (debugCreationErrors.size() != 0) {
for (String s : debugCreationErrors) {
errln("Creation error: " + s);
}
} else {
checkCdf("special cdf ", cdf, testItems);
}
}
use of android.icu.text.CompactDecimalFormat in project j2objc by google.
the class CompactDecimalFormatTest method TestEquals.
@Test
public void TestEquals() {
CompactDecimalFormat cdf = CompactDecimalFormat.getInstance(ULocale.forLanguageTag("sw"), CompactStyle.SHORT);
CompactDecimalFormat equalsCdf = CompactDecimalFormat.getInstance(ULocale.forLanguageTag("sw"), CompactStyle.SHORT);
CompactDecimalFormat notEqualsCdf = CompactDecimalFormat.getInstance(ULocale.forLanguageTag("sw"), CompactStyle.LONG);
assertEquals("equals", cdf, equalsCdf);
assertNotEquals("not equals", cdf, notEqualsCdf);
}
use of android.icu.text.CompactDecimalFormat in project j2objc by google.
the class CompactDecimalFormatTest method TestFieldPosition.
@Test
public void TestFieldPosition() {
CompactDecimalFormat cdf = getCDFInstance(ULocale.forLanguageTag("sw"), CompactStyle.SHORT);
FieldPosition fp = new FieldPosition(0);
StringBuffer sb = new StringBuffer();
cdf.format(1234567f, sb, fp);
assertEquals("fp string", "M1.2", sb.toString());
assertEquals("fp start", 1, fp.getBeginIndex());
assertEquals("fp end", 2, fp.getEndIndex());
}
Aggregations