void CalendarRegressionTest::test4145158()
{
    UErrorCode status = U_ZERO_ERROR;
    GregorianCalendar *calendar = new GregorianCalendar(status);
    if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete calendar;
      return;
    }

    calendar->adoptTimeZone(TimeZone::createTimeZone("GMT"));

    calendar->setTime(makeDate(INT32_MIN),status);
    int32_t year1 = calendar->get(UCAL_YEAR,status);
    int32_t era1 = calendar->get(UCAL_ERA,status);

    calendar->setTime(makeDate(INT32_MAX),status);
    int32_t year2 = calendar->get(UCAL_YEAR,status);
    int32_t era2 = calendar->get(UCAL_ERA,status);

    if (year1 == year2 && era1 == era2) {
        errln("Fail: Long.MIN_VALUE or Long.MAX_VALUE wrapping around");
    }

    delete calendar;
}
void CalendarRegressionTest::test4145158()
{
    UErrorCode status = U_ZERO_ERROR;
    GregorianCalendar *calendar = new GregorianCalendar(status);
    if(status == U_USING_FALLBACK_WARNING || U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete calendar;
      return;
    }

    calendar->adoptTimeZone(TimeZone::createTimeZone("GMT"));

    calendar->setTime(makeDate(INT32_MIN),status);
    int32_t year1 = calendar->get(UCAL_YEAR,status);
    int32_t era1 = calendar->get(UCAL_ERA,status);

    calendar->setTime(makeDate(INT32_MAX),status);
    int32_t year2 = calendar->get(UCAL_YEAR,status);
    int32_t era2 = calendar->get(UCAL_ERA,status);

    if (year1 == year2 && era1 == era2) {
        errln("Fail: Long.MIN_VALUE or Long.MAX_VALUE wrapping around");
    }

    delete calendar;
}