use of android.icu.util.IslamicCalendar in project j2objc by google.
the class IslamicTest method TestIslamicTabularDates.
@Test
public void TestIslamicTabularDates() {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
Date date = null;
try {
date = formatter.parse("1975-05-06");
} catch (Exception e) {
errln("unable to parse test date string - errMsg:" + e.getLocalizedMessage());
}
IslamicCalendar is_cal = new IslamicCalendar();
is_cal.setCalculationType(CalculationType.ISLAMIC_CIVIL);
is_cal.setTime(date);
IslamicCalendar is_cal2 = new IslamicCalendar();
is_cal2.setCalculationType(CalculationType.ISLAMIC_TBLA);
is_cal2.setTime(date);
int is_month = is_cal.get(Calendar.MONTH);
int is_month2 = is_cal2.get(Calendar.MONTH);
int is_year = is_cal.get(Calendar.YEAR);
int is_year2 = is_cal2.get(Calendar.YEAR);
if ((is_month != is_month2) || (is_year != is_year2))
errln("unexpected difference between islamic and tbla month " + is_month + " : " + is_month2 + " and/or year " + is_year + " : " + is_year2);
int is_day = is_cal.get(Calendar.DAY_OF_MONTH);
int is_day2 = is_cal2.get(Calendar.DAY_OF_MONTH);
if (is_day2 - is_day != 1)
errln("unexpected difference between civil and tbla: " + is_day2 + " : " + is_day);
}
use of android.icu.util.IslamicCalendar in project j2objc by google.
the class IslamicTest method TestBasic.
@Test
public void TestBasic() {
IslamicCalendar cal = newCivil();
cal.clear();
cal.set(1000, 0, 30);
logln("1000/0/30 -> " + cal.get(YEAR) + "/" + cal.get(MONTH) + "/" + cal.get(DATE));
cal.clear();
cal.set(1, 0, 30);
logln("1/0/30 -> " + cal.get(YEAR) + "/" + cal.get(MONTH) + "/" + cal.get(DATE));
}
use of android.icu.util.IslamicCalendar in project j2objc by google.
the class IslamicTest method newIslamicUmalqura.
private static IslamicCalendar newIslamicUmalqura() {
IslamicCalendar civilCalendar = new IslamicCalendar();
civilCalendar.setCalculationType(CalculationType.ISLAMIC_UMALQURA);
return civilCalendar;
}
use of android.icu.util.IslamicCalendar in project j2objc by google.
the class IslamicTest method newCivil.
private static IslamicCalendar newCivil() {
IslamicCalendar civilCalendar = new IslamicCalendar();
civilCalendar.setCalculationType(CalculationType.ISLAMIC_CIVIL);
return civilCalendar;
}
use of android.icu.util.IslamicCalendar in project j2objc by google.
the class IslamicTest method TestRoll.
@Test
public void TestRoll() {
int[][] tests = new int[][] { // non-leap years
{ 0001, QIDAH, 2, MONTH, 1, 0001, HIJJAH, 2 }, { 0001, QIDAH, 2, MONTH, 2, 0001, MUHARRAM, 2 }, { 0001, QIDAH, 2, MONTH, -1, 0001, SHAWWAL, 2 }, { 0001, MUHARRAM, 2, MONTH, 12, 0001, MUHARRAM, 2 }, { 0001, MUHARRAM, 2, MONTH, 13, 0001, SAFAR, 2 }, // 29-day month
{ 0001, HIJJAH, 1, DATE, 30, 0001, HIJJAH, 2 }, // 30-day month
{ 0002, HIJJAH, 1, DATE, 31, 0002, HIJJAH, 2 }, // Try some rolls that require other fields to be adjusted
{ 0001, MUHARRAM, 30, MONTH, 1, 0001, SAFAR, 29 }, { 0002, HIJJAH, 30, YEAR, -1, 0001, HIJJAH, 29 } };
IslamicCalendar cal = newCivil();
doRollAdd(ROLL, cal, tests);
cal = newIslamicUmalqura();
doRollAdd(ROLL, cal, tests);
}
Aggregations