blob: d3d1b699d472cfda626f3ef6840574bf9e415230 [file] [log] [blame]
Lei YU2f9c0cc2017-01-20 14:02:03 +08001#include "epoch_base.hpp"
Gunnar Millsab4cc6a2018-09-14 14:42:39 -05002#include "types.hpp"
3
4#include <sdbusplus/bus.hpp>
5
6#include <gtest/gtest.h>
Lei YU2f9c0cc2017-01-20 14:02:03 +08007
8namespace phosphor
9{
10namespace time
11{
12
13class TestEpochBase : public testing::Test
14{
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050015 public:
16 sdbusplus::bus::bus bus;
17 EpochBase epochBase;
Lei YU2f9c0cc2017-01-20 14:02:03 +080018
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050019 TestEpochBase() : bus(sdbusplus::bus::new_default()), epochBase(bus, "")
20 {
21 // Empty
22 }
Lei YU2f9c0cc2017-01-20 14:02:03 +080023
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050024 Mode getMode()
25 {
26 return epochBase.timeMode;
27 }
Lei YU2f9c0cc2017-01-20 14:02:03 +080028};
29
Lei YU415b9642017-02-09 11:37:26 +080030TEST_F(TestEpochBase, onModeChange)
Lei YU2f9c0cc2017-01-20 14:02:03 +080031{
Lei YU415b9642017-02-09 11:37:26 +080032 epochBase.onModeChanged(Mode::NTP);
33 EXPECT_EQ(Mode::NTP, getMode());
Lei YU2f9c0cc2017-01-20 14:02:03 +080034
Lei YUad143542017-07-25 14:27:07 +080035 epochBase.onModeChanged(Mode::Manual);
36 EXPECT_EQ(Mode::Manual, getMode());
Lei YU2f9c0cc2017-01-20 14:02:03 +080037}
38
Gunnar Millsab4cc6a2018-09-14 14:42:39 -050039} // namespace time
40} // namespace phosphor