summaryrefslogtreecommitdiff
path: root/tests/libntp/statestr.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-12-02 09:01:21 +0000
committer <>2014-12-04 16:11:25 +0000
commitbdab5265fcbf3f472545073a23f8999749a9f2b9 (patch)
treec6018dd03dea906f8f1fb5f105f05b71a7dc250a /tests/libntp/statestr.cpp
downloadntp-d4b7cd9723cce9561fa15f74b90b85a3a61b5ef8.tar.gz
Imported from /home/lorry/working-area/delta_ntp/ntp-dev-4.2.7p482.tar.gz.ntp-dev-4.2.7p482
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));
+}