xref: /netbsd-src/external/bsd/ntp/dist/tests/libntp/statestr.c (revision cdfa2a7ef92791ba9db70a584a1d904730e6fb46)
1*cdfa2a7eSchristos /*	$NetBSD: statestr.c,v 1.2 2020/05/25 20:47:36 christos Exp $	*/
2067f5680Schristos 
3f17b710fSchristos #include "config.h"
4f17b710fSchristos 
5f17b710fSchristos #include "ntp_stdlib.h"
6a6f3f22fSchristos #include "ntp.h" // needed for MAX_MAC_LEN used in ntp_control.h
7f17b710fSchristos #include "ntp_control.h"
8f17b710fSchristos 
9f17b710fSchristos #include "unity.h"
10f17b710fSchristos 
114c290c01Schristos void setUp(void);
12a6f3f22fSchristos void test_PeerRestart(void);
13a6f3f22fSchristos void test_SysUnspecified(void);
14a6f3f22fSchristos void test_ClockCodeExists(void);
15a6f3f22fSchristos void test_ClockCodeUnknown(void);
16f17b710fSchristos 
174c290c01Schristos 
184c290c01Schristos void
setUp(void)194c290c01Schristos setUp(void)
204c290c01Schristos {
214c290c01Schristos 	init_lib();
224c290c01Schristos 
234c290c01Schristos 	return;
244c290c01Schristos }
254c290c01Schristos 
264c290c01Schristos 
27f17b710fSchristos // eventstr()
28a6f3f22fSchristos void
test_PeerRestart(void)29a6f3f22fSchristos test_PeerRestart(void) {
30f17b710fSchristos 	TEST_ASSERT_EQUAL_STRING("restart", eventstr(PEVNT_RESTART));
31f17b710fSchristos }
32f17b710fSchristos 
33a6f3f22fSchristos 
34a6f3f22fSchristos void
test_SysUnspecified(void)35a6f3f22fSchristos test_SysUnspecified(void) {
36f17b710fSchristos 	TEST_ASSERT_EQUAL_STRING("unspecified", eventstr(EVNT_UNSPEC));
37f17b710fSchristos }
38f17b710fSchristos 
39a6f3f22fSchristos 
40f17b710fSchristos // ceventstr()
41a6f3f22fSchristos void
test_ClockCodeExists(void)42a6f3f22fSchristos test_ClockCodeExists(void) {
43f17b710fSchristos 	TEST_ASSERT_EQUAL_STRING("clk_unspec", ceventstr(CTL_CLK_OKAY));
44f17b710fSchristos }
45f17b710fSchristos 
46a6f3f22fSchristos 
47a6f3f22fSchristos void
test_ClockCodeUnknown(void)48a6f3f22fSchristos test_ClockCodeUnknown(void) {
49f17b710fSchristos 	TEST_ASSERT_EQUAL_STRING("clk_-1", ceventstr(-1));
50f17b710fSchristos }
51