blob: b193969ee99cf78bac678057810e44e9bb515b08 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "epoch_base.hpp"
#include "types.hpp"
#include <sdbusplus/bus.hpp>
#include <gtest/gtest.h>
namespace phosphor
{
namespace time
{
class TestEpochBase : public testing::Test
{
public:
sdbusplus::bus::bus bus;
EpochBase epochBase;
TestEpochBase() : bus(sdbusplus::bus::new_default()), epochBase(bus, "")
{
// Empty
}
Mode getMode()
{
return epochBase.timeMode;
}
Owner getOwner()
{
return epochBase.timeOwner;
}
};
TEST_F(TestEpochBase, onModeChange)
{
epochBase.onModeChanged(Mode::NTP);
EXPECT_EQ(Mode::NTP, getMode());
epochBase.onModeChanged(Mode::Manual);
EXPECT_EQ(Mode::Manual, getMode());
}
TEST_F(TestEpochBase, onOwnerChange)
{
epochBase.onOwnerChanged(Owner::BMC);
EXPECT_EQ(Owner::BMC, getOwner());
epochBase.onOwnerChanged(Owner::Host);
EXPECT_EQ(Owner::Host, getOwner());
epochBase.onOwnerChanged(Owner::Split);
EXPECT_EQ(Owner::Split, getOwner());
epochBase.onOwnerChanged(Owner::Both);
EXPECT_EQ(Owner::Both, getOwner());
}
} // namespace time
} // namespace phosphor
|