1 #include "TimerTest.hpp"
3 #include "app/IntervalTimer.hpp"
5 CPPUNIT_TEST_SUITE_REGISTRATION(blank::test::TimerTest);
11 void TimerTest::setUp() {
14 void TimerTest::tearDown() {
18 void TimerTest::testIntervalTimer() {
19 IntervalTimer timer(50);
20 CPPUNIT_ASSERT_MESSAGE(
21 "fresh timer is running",
24 CPPUNIT_ASSERT_MESSAGE(
28 CPPUNIT_ASSERT_EQUAL_MESSAGE(
29 "fresh timer with non-zero elapsed time",
32 CPPUNIT_ASSERT_EQUAL_MESSAGE(
33 "fresh timer at non-zero iteration",
38 CPPUNIT_ASSERT_MESSAGE(
39 "startet timer is not running",
42 CPPUNIT_ASSERT_MESSAGE(
43 "started timer hit without update",
46 CPPUNIT_ASSERT_EQUAL_MESSAGE(
47 "started, but not updated timer with non-zero elapsed time",
50 CPPUNIT_ASSERT_EQUAL_MESSAGE(
51 "started, but not updated timer at non-zero iteration",
56 CPPUNIT_ASSERT_MESSAGE(
57 "updated timer is not running",
60 CPPUNIT_ASSERT_MESSAGE(
61 "timer hit after update, but before it should",
64 CPPUNIT_ASSERT_EQUAL_MESSAGE(
65 "wrong elapsed time on updated timer",
68 CPPUNIT_ASSERT_EQUAL_MESSAGE(
69 "wrong iteration on updated timer",
74 CPPUNIT_ASSERT_MESSAGE(
75 "timer not hit after updating to its exact interval time",
78 CPPUNIT_ASSERT_EQUAL_MESSAGE(
79 "wrong elapsed time on updated timer",
82 CPPUNIT_ASSERT_EQUAL_MESSAGE(
83 "wrong iteration on updated timer at exact interval time",
88 CPPUNIT_ASSERT_MESSAGE(
89 "timer hit after updating from exact interval time to just before the next",
92 CPPUNIT_ASSERT_EQUAL_MESSAGE(
93 "wrong elapsed time on updated timer",
96 CPPUNIT_ASSERT_EQUAL_MESSAGE(
97 "wrong iteration after updating timer from exact interval time to just before the next",
102 CPPUNIT_ASSERT_MESSAGE(
103 "timer not hit after updating across interval time boundary",
106 CPPUNIT_ASSERT_EQUAL_MESSAGE(
107 "wrong elapsed time on updated timer",
110 CPPUNIT_ASSERT_EQUAL_MESSAGE(
111 "wrong iteration after updating across interval time boundary",
116 CPPUNIT_ASSERT_MESSAGE(
117 "stopped timer is running",
120 CPPUNIT_ASSERT_MESSAGE(
124 CPPUNIT_ASSERT_EQUAL_MESSAGE(
125 "stopped timer has non-zero elapsed time",
128 CPPUNIT_ASSERT_EQUAL_MESSAGE(
129 "stopped timer at non-zero iteration",