if (every != -1)
{
- if (end < 0 || end > 86399 ||
- every < 1 || every > 86399 ||
+ if (end < 0 || end > 86400 ||
+ every < 1 || every > 86400 ||
begin > end)
return false;
}
else
{
// interval
- if (get_next_point(calc_from,begin,true) > get_next_point(calc_from,end,true))
+ if (get_next_point(calc_from,begin,true) > get_next_point(calc_from,end-1,true))
{
// next begin > next end means we are at the begin or within the interval
CPPUNIT_TEST(IntervalLaststepMatch);
CPPUNIT_TEST(IntervalEnd);
CPPUNIT_TEST(IntervalBigstep);
+ CPPUNIT_TEST(IntervalWholeDayStart);
+ CPPUNIT_TEST(IntervalWholeDayStartNow);
+ CPPUNIT_TEST(IntervalWholeDayEnd);
+ CPPUNIT_TEST(IntervalWholeDayWithin1);
+ CPPUNIT_TEST(IntervalWholeDayWithin2);
+ CPPUNIT_TEST(IntervalWholeDayWithinBoundary);
CPPUNIT_TEST_SUITE_END();
CPPUNIT_ASSERT_EQUAL( 1233187200, static_cast<int>(cron.get_next_run(1233100800)));
}
+ void IntervalWholeDayStart()
+ {
+ WeekCron cron("345",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233097200, static_cast<int>(cron.get_next_run(1233097199)));
+ }
+
+ void IntervalWholeDayStartNow()
+ {
+ WeekCron cron("345",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233097210, static_cast<int>(cron.get_next_run(1233097200)));
+ }
+
+ void IntervalWholeDayEnd()
+ {
+ WeekCron cron("2",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233615600, static_cast<int>(cron.get_next_run(1233097199)));
+ }
+
+ void IntervalWholeDayWithin1()
+ {
+ WeekCron cron("2345",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233097230, static_cast<int>(cron.get_next_run(1233097220)));
+ }
+
+ void IntervalWholeDayWithin2()
+ {
+ WeekCron cron("2345",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233097230, static_cast<int>(cron.get_next_run(1233097229)));
+ }
+
+ void IntervalWholeDayWithinBoundary()
+ {
+ WeekCron cron("2345",0,86400,10);
+ CPPUNIT_ASSERT_EQUAL( 1233097200, static_cast<int>(cron.get_next_run(1233097199)));
+ }
+
+
// TODO: Tom, add some evil tests here, im done here for yesterday ;)
// ideas:
// - daylightsaving on