summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/tests/libntp/g_statestr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ntp/tests/libntp/g_statestr.cpp')
-rw-r--r--contrib/ntp/tests/libntp/g_statestr.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/contrib/ntp/tests/libntp/g_statestr.cpp b/contrib/ntp/tests/libntp/g_statestr.cpp
new file mode 100644
index 0000000..dedbf5b
--- /dev/null
+++ b/contrib/ntp/tests/libntp/g_statestr.cpp
@@ -0,0 +1,28 @@
+#include "g_libntptest.h"
+
+extern "C" {
+#include "ntp.h" // Needed for MAX_MAC_LEN used in ntp_control.h
+#include "ntp_control.h"
+};
+
+class statestrTest : public libntptest {
+};
+
+// eventstr()
+TEST_F(statestrTest, PeerRestart) {
+ EXPECT_STREQ("restart", eventstr(PEVNT_RESTART));
+}
+
+TEST_F(statestrTest, SysUnspecified) {
+ EXPECT_STREQ("unspecified", eventstr(EVNT_UNSPEC));
+}
+
+// ceventstr()
+TEST_F(statestrTest, ClockCodeExists) {
+ EXPECT_STREQ("clk_unspec", ceventstr(CTL_CLK_OKAY));
+}
+
+TEST_F(statestrTest, ClockCodeUnknown) {
+ EXPECT_STREQ("clk_-1", ceventstr(-1));
+}
+
OpenPOWER on IntegriCloud