void CalendarRegressionTest::test4114578()
{
    UErrorCode status = U_ZERO_ERROR;
    double ONE_HOUR = 60*60*1000;
    Calendar *cal = Calendar::createInstance(status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete cal;
      return;
    }
    cal->adoptTimeZone(TimeZone::createTimeZone("PST"));
    UDate onset = makeDate(1998, UCAL_APRIL, 5, 1, 0) + ONE_HOUR;
    UDate cease = makeDate(1998, UCAL_OCTOBER, 25, 0, 0) + 2*ONE_HOUR;

    UBool fail = FALSE;

    const int32_t ADD = 1;
    const int32_t ROLL = 2;

    double DATA []= {
        // Start            Action   Amt    Expected_change
        onset - ONE_HOUR,   ADD,      1,     ONE_HOUR,
        onset,              ADD,     -1,    -ONE_HOUR,
        onset - ONE_HOUR,   ROLL,     1,     ONE_HOUR,
        onset,              ROLL,    -1,    -ONE_HOUR,
        cease - ONE_HOUR,   ADD,      1,     ONE_HOUR,
        cease,              ADD,     -1,    -ONE_HOUR,
        cease - ONE_HOUR,   ROLL,     1,     ONE_HOUR,
        cease,              ROLL,    -1,    -ONE_HOUR,
    };

    for (int32_t i=0; i<32; i+=4) {
        UDate date = DATA[i];
        int32_t amt = (int32_t) DATA[i+2];
        double expectedChange = DATA[i+3];

        log(UnicodeString("") + date);
        cal->setTime(date,status);

        switch ((int32_t) DATA[i+1]) {
        case ADD:
            log(UnicodeString(" add (HOUR,") + (amt<0?"":"+")+amt + ")= ");
            cal->add(UCAL_HOUR, amt,status);
            break;
        case ROLL:
            log(UnicodeString(" roll(HOUR,") + (amt<0?"":"+")+amt + ")= ");
            cal->roll(UCAL_HOUR, amt,status);
            break;
        }

        log(UnicodeString("") + cal->getTime(status));

        double change = cal->getTime(status) - date;
        if (change != expectedChange) {
            fail = TRUE;
            logln(" FAIL");
        }
        else logln(" OK");
    }

    if (fail) errln("Fail: roll/add misbehaves around DST onset/cease");

    delete cal;
}
void CalendarRegressionTest::test4114578()
{
    UErrorCode status = U_ZERO_ERROR;
    double ONE_HOUR = 60*60*1000;
    Calendar *cal = Calendar::createInstance(status);
    if(U_FAILURE(status)) {
      dataerrln("Error creating calendar %s", u_errorName(status));
      delete cal;
      return;
    }
    cal->adoptTimeZone(TimeZone::createTimeZone("PST"));
    UDate onset = makeDate(1998, UCAL_APRIL, 5, 1, 0) + ONE_HOUR;
    UDate cease = makeDate(1998, UCAL_OCTOBER, 25, 0, 0) + 2*ONE_HOUR;

    UBool fail = FALSE;

    const int32_t ADD = 1;
    const int32_t ROLL = 2;

    double DATA []= {
         
        onset - ONE_HOUR,   ADD,      1,     ONE_HOUR,
        onset,              ADD,     -1,    -ONE_HOUR,
        onset - ONE_HOUR,   ROLL,     1,     ONE_HOUR,
        onset,              ROLL,    -1,    -ONE_HOUR,
        cease - ONE_HOUR,   ADD,      1,     ONE_HOUR,
        cease,              ADD,     -1,    -ONE_HOUR,
        cease - ONE_HOUR,   ROLL,     1,     ONE_HOUR,
        cease,              ROLL,    -1,    -ONE_HOUR,
    };

    for (int32_t i=0; i<32; i+=4) {
        UDate date = DATA[i];
        int32_t amt = (int32_t) DATA[i+2];
        double expectedChange = DATA[i+3];

        log(UnicodeString("") + date);
        cal->setTime(date,status);

        switch ((int32_t) DATA[i+1]) {
        case ADD:
            log(UnicodeString(" add (HOUR,") + (amt<0?"":"+")+amt + ")= ");
            cal->add(UCAL_HOUR, amt,status);
            break;
        case ROLL:
            log(UnicodeString(" roll(HOUR,") + (amt<0?"":"+")+amt + ")= ");
            cal->roll(UCAL_HOUR, amt,status);
            break;
        }

        log(UnicodeString("") + cal->getTime(status));

        double change = cal->getTime(status) - date;
        if (change != expectedChange) {
            fail = TRUE;
            logln(" FAIL");
        }
        else logln(" OK");
    }

    if (fail) errln("Fail: roll/add misbehaves around DST onset/cease");

    delete cal;
}