Scheduler
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
utils
tests
countingWheelTest.cpp
Go to the documentation of this file.
1
10
#include <gtest/gtest.h>
11
#include <
utils/countingWheel.h
>
12
13
14
TEST
(CountingWheel, testInitialization)
15
{
16
Utils::CountingWheel
wheel(7);
17
wheel.
initialize
();
18
EXPECT_EQ(0u, wheel.
getValue
());
19
EXPECT_EQ(7u, wheel.
getBase
());
20
}
21
22
23
TEST
(CountingWheel, incrementAndCarryTest)
24
{
25
Utils::CountingWheel
wheel(3);
26
wheel.
initialize
();
27
bool
carry = wheel.
increment
();
28
EXPECT_EQ(1u, wheel.
getValue
());
29
EXPECT_FALSE(carry);
30
31
carry = wheel.
increment
();
32
EXPECT_EQ(2u, wheel.
getValue
());
33
EXPECT_FALSE(carry);
34
35
carry = wheel.
increment
();
36
EXPECT_EQ(0u, wheel.
getValue
());
37
EXPECT_TRUE(carry);
38
}
39
TEST
(CountingWheel, baseZeroTest)
40
{
41
Utils::CountingWheel
wheel0(0);
42
bool
carry =
false
;
43
wheel0.
initialize
();
44
EXPECT_EQ(0u, wheel0.
getValue
());
45
carry = wheel0.
increment
();
46
EXPECT_EQ(0u, wheel0.
getValue
());
47
EXPECT_TRUE(carry);
48
}
49
50
Utils::CountingWheel::initialize
void initialize()
Definition:
countingWheel.cpp:20
countingWheel.h
Utils::CountingWheel
Definition:
countingWheel.h:16
Utils::CountingWheel::getBase
unsigned int getBase()
Definition:
countingWheel.cpp:45
TEST
TEST(CountingWheel, testInitialization)
Definition:
countingWheelTest.cpp:14
Utils::CountingWheel::increment
bool increment()
Definition:
countingWheel.cpp:25
Utils::CountingWheel::getValue
unsigned int getValue()
Definition:
countingWheel.cpp:38
Generated on Sun Nov 26 2017 17:01:36 for Scheduler by
1.8.11