Implement part of BmcEpoch
Add BmcEpoch which inherits EpochBase and will handle times for BMC,
it is partly implemented.
Add unit test cases to test basic functions.
Change-Id: Ia5e4d0f884156d238f3f84df490a2efbce43e89a
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/test/TestBmcEpoch.cpp b/test/TestBmcEpoch.cpp
new file mode 100644
index 0000000..67f89bb
--- /dev/null
+++ b/test/TestBmcEpoch.cpp
@@ -0,0 +1,55 @@
+#include <sdbusplus/bus.hpp>
+#include <gtest/gtest.h>
+
+#include "bmc_epoch.hpp"
+#include "config.h"
+
+namespace phosphor
+{
+namespace time
+{
+
+class TestBmcEpoch : public testing::Test
+{
+ public:
+ using Mode = EpochBase::Mode;
+ using Owner = EpochBase::Owner;
+
+ sdbusplus::bus::bus bus;
+ BmcEpoch bmcEpoch;
+
+ TestBmcEpoch()
+ : bus(sdbusplus::bus::new_default()),
+ bmcEpoch(bus, OBJPATH_BMC)
+ {
+ // Empty
+ }
+
+ // Proxies for BmcEpoch's private members and functions
+ Mode getTimeMode()
+ {
+ return bmcEpoch.timeMode;
+ }
+ Owner getTimeOwner()
+ {
+ return bmcEpoch.timeOwner;
+ }
+};
+
+TEST_F(TestBmcEpoch, empty)
+{
+ EXPECT_EQ(Mode::NTP, getTimeMode());
+ EXPECT_EQ(Owner::BMC, getTimeOwner());
+}
+
+TEST_F(TestBmcEpoch, getElapsed)
+{
+ auto t1 = bmcEpoch.elapsed();
+ EXPECT_NE(0, t1);
+ auto t2 = bmcEpoch.elapsed();
+ EXPECT_GE(t2, t1);
+}
+
+
+}
+}