add even more interval-unit-tests. one is failing though, don't know why yet.
authorGerd von Egidy <gerd.von.egidy@intra2net.com>
Fri, 30 Jan 2009 17:20:37 +0000 (18:20 +0100)
committerGerd von Egidy <gerd.von.egidy@intra2net.com>
Fri, 30 Jan 2009 17:21:42 +0000 (18:21 +0100)
test/test_cron.cpp

index d51c97b..239dafd 100644 (file)
@@ -93,6 +93,10 @@ class TestCronFunc : public TestFixture
     CPPUNIT_TEST(IntervalOutFirstDSTBackwards2);
     CPPUNIT_TEST(IntervalOutFirstDSTBackwards3);
     CPPUNIT_TEST(IntervalOutFirstDSTBackwards4);
+    CPPUNIT_TEST(IntervalOutSecondDSTBackwards1);
+    CPPUNIT_TEST(IntervalOutSecondDSTBackwards2);
+    CPPUNIT_TEST(IntervalOutSecondDSTBackwards3);
+    CPPUNIT_TEST(IntervalOutSecondDSTBackwards4);
 
     CPPUNIT_TEST(StartHourStaysTheSameTill2038);
 
@@ -571,6 +575,38 @@ public:
         CPPUNIT_ASSERT_EQUAL( static_cast<time_t>(1224984600), cron.get_next_run(1224984540));
     }
 
+    void IntervalOutSecondDSTBackwards1()
+    {
+        WeekCron cron("0123456",12600,18000,60);
+        // calc at: Sun Oct 26 02:29:59 2008
+        // expected next run: Sun Oct 26 02:30:00 2008
+        CPPUNIT_ASSERT_EQUAL( static_cast<time_t>(1224984600), cron.get_next_run(1224984599));
+    }
+
+    void IntervalOutSecondDSTBackwards2()
+    {
+        WeekCron cron("0123456",12600,18000,60);
+        // calc at: Sun Oct 26 02:30:00 2008
+        // expected next run: Sun Oct 26 02:31:00 2008
+        CPPUNIT_ASSERT_EQUAL( static_cast<time_t>(1224984660), cron.get_next_run(1224984600));
+    }
+
+    void IntervalOutSecondDSTBackwards3()
+    {
+        WeekCron cron("0123456",12600,18000,60);
+        // calc at: Sun Oct 26 02:59:59 2008
+        // expected next run: Sun Oct 26 03:00:00 2008
+        CPPUNIT_ASSERT_EQUAL( static_cast<time_t>(1224986400), cron.get_next_run(1224986399));
+    }
+
+    void IntervalOutSecondDSTBackwards4()
+    {
+        WeekCron cron("0123456",12600,18000,60);
+        // calc at: Sun Oct 26 03:00:00 2008
+        // expected next run: Sun Oct 26 03:01:00 2008
+        CPPUNIT_ASSERT_EQUAL( static_cast<time_t>(1224986460), cron.get_next_run(1224986400));
+    }
+
     void StartHourStaysTheSameTill2038()
     {
         int daysec = 79200;