blob: 67f89bb43c7ced8b86e440f727501c6dbdcf9e48 [file] [log] [blame]
Lei YU96232822017-01-20 14:05:46 +08001#include <sdbusplus/bus.hpp>
2#include <gtest/gtest.h>
3
4#include "bmc_epoch.hpp"
5#include "config.h"
6
7namespace phosphor
8{
9namespace time
10{
11
12class TestBmcEpoch : public testing::Test
13{
14 public:
15 using Mode = EpochBase::Mode;
16 using Owner = EpochBase::Owner;
17
18 sdbusplus::bus::bus bus;
19 BmcEpoch bmcEpoch;
20
21 TestBmcEpoch()
22 : bus(sdbusplus::bus::new_default()),
23 bmcEpoch(bus, OBJPATH_BMC)
24 {
25 // Empty
26 }
27
28 // Proxies for BmcEpoch's private members and functions
29 Mode getTimeMode()
30 {
31 return bmcEpoch.timeMode;
32 }
33 Owner getTimeOwner()
34 {
35 return bmcEpoch.timeOwner;
36 }
37};
38
39TEST_F(TestBmcEpoch, empty)
40{
41 EXPECT_EQ(Mode::NTP, getTimeMode());
42 EXPECT_EQ(Owner::BMC, getTimeOwner());
43}
44
45TEST_F(TestBmcEpoch, getElapsed)
46{
47 auto t1 = bmcEpoch.elapsed();
48 EXPECT_NE(0, t1);
49 auto t2 = bmcEpoch.elapsed();
50 EXPECT_GE(t2, t1);
51}
52
53
54}
55}