diff options
| author | Lei YU <mine260309@gmail.com> | 2017-01-20 14:05:46 +0800 |
|---|---|---|
| committer | Lei YU <mine260309@gmail.com> | 2017-08-01 10:31:07 +0800 |
| commit | 962328277259ce12115fa6bf7ae31f43f1951dd0 (patch) | |
| tree | 6c23ed91355444f687caa49368d26f9b7a4c17e5 /test | |
| parent | 2f9c0cc25478709f25f449d46ab9836152cf1cd9 (diff) | |
| download | phosphor-time-manager-962328277259ce12115fa6bf7ae31f43f1951dd0.tar.gz phosphor-time-manager-962328277259ce12115fa6bf7ae31f43f1951dd0.zip | |
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>
Diffstat (limited to 'test')
| -rw-r--r-- | test/Makefile.am | 3 | ||||
| -rw-r--r-- | test/TestBmcEpoch.cpp | 55 |
2 files changed, 57 insertions, 1 deletions
diff --git a/test/Makefile.am b/test/Makefile.am index 66e1ae5..26c4c15 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -6,7 +6,8 @@ TESTS = $(check_PROGRAMS) check_PROGRAMS += test test_SOURCES = \ - TestEpochBase.cpp + TestEpochBase.cpp \ + TestBmcEpoch.cpp test_LDADD = $(top_builddir)/libtimemanager.la 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); +} + + +} +} |

