26
26
#include "test-timer.h"
29
CompTimerTestSetValues::cb (int timernum)
34
std::cout << "PASS: testing values" << std::endl;
40
CompTimerTestSetValues::precallback ()
42
CompTimer *t1, *t2, *t3;
44
std::cout << "-= TEST: testing values" << std::endl;
46
t1 = new CompTimer ();
29
TEST_F(CompTimerTest, TimerSetValues)
31
CompTimer* t1 = new CompTimer ();
48
33
t1->setTimes (100, 90);
49
t1->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 1));
52
if (t1->minTime () != 100)
54
std::cout << "FAIL: min time was not the min value passed" << std::endl;
58
if (t1->maxTime () != 100)
60
std::cout << "FAIL: max time was not the min value passed" << std::endl;
64
if (t1->minLeft () != 100)
66
std::cout << "FAIL: min left was not the min value passed " << std::endl;
70
if (t1->maxLeft () != 100)
72
std::cout << "FAIL: max left was not the min value passed" << std::endl;
76
t2 = new CompTimer ();
78
t2->setTimes (100, 110);
79
t2->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 2));
82
if (t2->minTime () != 100)
84
std::cout << "FAIL: min time was not the min value passed" << std::endl;
88
if (t2->maxTime () != 110)
90
std::cout << "FAIL: max time was not the max value passed" << std::endl;
94
if (t2->minLeft () != 100)
96
std::cout << "FAIL: min left was not the min value passed " << std::endl;
100
if (t2->maxLeft () != 110)
102
std::cout << "FAIL: max left was not the max value passed" << std::endl;
106
t3 = new CompTimer ();
109
t3->setCallback (boost::bind (&CompTimerTestSetValues::cb, this, 3));
112
if (t3->minTime () != 100)
114
std::cout << "FAIL: min time was not the value passed" << std::endl;
118
if (t3->maxTime () != 100)
120
std::cout << "FAIL: max time was not the value passed" << std::endl;
124
if (t3->minLeft () != 100)
126
std::cout << "FAIL: min left was not the value passed" << t3->minLeft () << std::endl;
130
if (t3->maxLeft () != 100)
132
std::cout << "FAIL: max left was not the value passed" << std::endl;
136
timers.push_back (t1);
137
timers.push_back (t2);
138
timers.push_back (t3);
38
/* minLeft and maxLeft are now
39
* real-time, so wait the guarunteed
40
* expiry time in order to check them
41
* for an accurate value of zero */
43
ASSERT_EQ (t1->minTime(), 100);
44
ASSERT_EQ (t1->maxTime(), 100);
45
ASSERT_EQ (t1->minLeft(), 0);
46
ASSERT_EQ (t1->maxLeft(), 0);