[UTC][calendar-service2][Non-ACR][rules out monthly test when date is 1st]
authorJeesun Kim <iamjs.kim@samsung.com>
Wed, 25 Oct 2017 01:01:11 +0000 (10:01 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Wed, 25 Oct 2017 01:01:27 +0000 (10:01 +0900)
Change-Id: Ic9bf9e6c6eba80bb2d5c26d5e7c34b87bedfbeba

src/utc/calendar-service2/utc-calendar-reminder.c

index d2eeaca560eaed426abb97741e3f847ad91b5a38..9906408aea9178715cc1421273a5e7a0f624d673 100755 (executable)
@@ -461,6 +461,7 @@ int utc_calendar_reminder_add_cb_utime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -471,6 +472,7 @@ int utc_calendar_reminder_add_cb_utime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -481,6 +483,7 @@ int utc_calendar_reminder_add_cb_utime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -518,6 +521,7 @@ int utc_calendar_reminder_add_cb_utime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -528,6 +532,7 @@ int utc_calendar_reminder_add_cb_utime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -538,6 +543,7 @@ int utc_calendar_reminder_add_cb_utime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -570,7 +576,7 @@ int utc_calendar_reminder_add_cb_utime_monthly_p(void)
        now_t += 5;
        now_t += 60;                                    /* add 1 min */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -585,11 +591,12 @@ int utc_calendar_reminder_add_cb_utime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -604,11 +611,12 @@ int utc_calendar_reminder_add_cb_utime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -623,11 +631,12 @@ int utc_calendar_reminder_add_cb_utime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -672,6 +681,7 @@ int utc_calendar_reminder_add_cb_utime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -684,6 +694,7 @@ int utc_calendar_reminder_add_cb_utime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -696,6 +707,7 @@ int utc_calendar_reminder_add_cb_utime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -761,6 +773,7 @@ int utc_calendar_reminder_add_cb_localtime_once_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, once");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -771,6 +784,7 @@ int utc_calendar_reminder_add_cb_localtime_once_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, once");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -781,6 +795,7 @@ int utc_calendar_reminder_add_cb_localtime_once_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, once");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -820,6 +835,7 @@ int utc_calendar_reminder_add_cb_localtime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -831,6 +847,7 @@ int utc_calendar_reminder_add_cb_localtime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -842,6 +859,7 @@ int utc_calendar_reminder_add_cb_localtime_daily_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, daily");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -872,6 +890,7 @@ int utc_calendar_reminder_add_cb_localtime_weekly_p(void)
        struct tm now_s = {0};
 
        /* localtime weekly */
+       DBG("add 1 min, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += 60;                                    /* add 1 min */
@@ -883,6 +902,7 @@ int utc_calendar_reminder_add_cb_localtime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -894,6 +914,7 @@ int utc_calendar_reminder_add_cb_localtime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -905,6 +926,7 @@ int utc_calendar_reminder_add_cb_localtime_weekly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, weekly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
@@ -938,7 +960,7 @@ int utc_calendar_reminder_add_cb_localtime_monthly_p(void)
        now_t += 5;
        now_t += 60;                                    /* add 1 min */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -952,11 +974,12 @@ int utc_calendar_reminder_add_cb_localtime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -970,11 +993,12 @@ int utc_calendar_reminder_add_cb_localtime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -988,11 +1012,12 @@ int utc_calendar_reminder_add_cb_localtime_monthly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, monthly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */
        localtime_r(&now_t, &now_s);
-       if (28 < now_s.tm_mday)                 /* if mday goes over 28, alarm needs more params */
+       if (now_s.tm_mday < 2 || 28 < now_s.tm_mday)                    /* if mday goes over 28, alarm needs more params */
                return 0;
        if (0 == now_s.tm_mon) { /* Jan */
                now_s.tm_year--;
@@ -1035,6 +1060,7 @@ int utc_calendar_reminder_add_cb_localtime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 hour, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60);                             /* add 1 hour */
@@ -1046,6 +1072,7 @@ int utc_calendar_reminder_add_cb_localtime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 day, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24);                /* add 1 day */
@@ -1057,6 +1084,7 @@ int utc_calendar_reminder_add_cb_localtime_yearly_p(void)
        ret = _delete_event(event_id);
        assert_eq(ret, CALENDAR_ERROR_NONE);
 
+       DBG("add 1 week, yearly");
        now_t = time(NULL);
        now_t += 5;
        now_t += (60 * 60 * 24 * 7);    /* add 1 week */