summaryrefslogtreecommitdiff
path: root/tests/libntp/statestr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/libntp/statestr.cpp')
-rw-r--r--tests/libntp/statestr.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/libntp/statestr.cpp b/tests/libntp/statestr.cpp
new file mode 100644
index 0000000..506b079
--- /dev/null
+++ b/tests/libntp/statestr.cpp
@@ -0,0 +1,27 @@
+#include "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));
+}