use of android.icu.util.DateInterval in project j2objc by google.
the class DateIntervalFormatTest method expect.
private void expect(String[] data, int data_length) {
int i = 1;
while (i < data_length) {
String locName = data[i++];
ULocale loc = new ULocale(locName);
SimpleDateFormat ref = new SimpleDateFormat(data[0], loc);
// 'f'
String datestr = data[i++];
String datestr_2 = data[i++];
Date date, date_2;
try {
date = ref.parse(datestr);
date_2 = ref.parse(datestr_2);
} catch (ParseException e) {
errln("parse exception" + e);
continue;
}
DateInterval dtitv = new DateInterval(date.getTime(), date_2.getTime());
String oneSkeleton = data[i++];
DateIntervalFormat dtitvfmt = DateIntervalFormat.getInstance(oneSkeleton, loc);
String expected = data[i++];
String formatted = dtitvfmt.format(dtitv);
if (!formatted.equals(Utility.unescape(expected))) {
errln("\"" + locName + "\\" + oneSkeleton + "\\" + datestr + "\\" + datestr_2 + "\"\t expected: " + expected + "\tgot: " + formatted + "\n");
}
}
}
Aggregations