void CalendarRegressionTest::test4125881()
{
    UErrorCode status = U_ZERO_ERROR;
    GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete cal;
      return;
    }
    DateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"),status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating SimpleDateFormat - %s", u_errorName(status));
      delete cal;
      return;
    }
    cal->clear();
    for (int32_t y=-20; y<=10; ++y) {
        cal->set(UCAL_ERA, y < 1 ? GregorianCalendar::BC : GregorianCalendar::AD);
        cal->set(UCAL_YEAR, y < 1 ? 1 - y : y);
        UnicodeString temp;
        logln(UnicodeString("") + y + UnicodeString(" = ") + fmt->format(cal->getTime(status), temp) + " " +
                           cal->isLeapYear(y));
        if (cal->isLeapYear(y) != ((y+40)%4 == 0))
            errln("Leap years broken");
    }

    delete cal;
    delete fmt;
}
void CalendarRegressionTest::test4125881()
{
    UErrorCode status = U_ZERO_ERROR;
    GregorianCalendar *cal = (GregorianCalendar*) Calendar::createInstance(status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete cal;
      return;
    }
    DateFormat *fmt = new SimpleDateFormat(UnicodeString("MMMM d, yyyy G"),status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating SimpleDateFormat - %s", u_errorName(status));
      delete cal;
      return;
    }
    cal->clear();
    for (int32_t y=-20; y<=10; ++y) {
        cal->set(UCAL_ERA, y < 1 ? GregorianCalendar::BC : GregorianCalendar::AD);
        cal->set(UCAL_YEAR, y < 1 ? 1 - y : y);
        UnicodeString temp;
        logln(UnicodeString("") + y + UnicodeString(" = ") + fmt->format(cal->getTime(status), temp) + " " +
                           cal->isLeapYear(y));
        if (cal->isLeapYear(y) != ((y+40)%4 == 0))
            errln("Leap years broken");
    }

    delete cal;
    delete fmt;
}