xref: /netbsd-src/external/bsd/ntp/dist/tests/libntp/statestr.c (revision 397d6dd69b7c53b00e1306290a03b5ac2143c4e2)
1 #include "config.h"
2 
3 #include "ntp_stdlib.h"
4 #include "ntp.h" // needed for MAX_MAC_LEN used in ntp_control.h
5 #include "ntp_control.h"
6 
7 #include "unity.h"
8 
9 void setUp(void);
10 void test_PeerRestart(void);
11 void test_SysUnspecified(void);
12 void test_ClockCodeExists(void);
13 void test_ClockCodeUnknown(void);
14 
15 
16 void
17 setUp(void)
18 {
19 	init_lib();
20 
21 	return;
22 }
23 
24 
25 // eventstr()
26 void
27 test_PeerRestart(void) {
28 	TEST_ASSERT_EQUAL_STRING("restart", eventstr(PEVNT_RESTART));
29 }
30 
31 
32 void
33 test_SysUnspecified(void) {
34 	TEST_ASSERT_EQUAL_STRING("unspecified", eventstr(EVNT_UNSPEC));
35 }
36 
37 
38 // ceventstr()
39 void
40 test_ClockCodeExists(void) {
41 	TEST_ASSERT_EQUAL_STRING("clk_unspec", ceventstr(CTL_CLK_OKAY));
42 }
43 
44 
45 void
46 test_ClockCodeUnknown(void) {
47 	TEST_ASSERT_EQUAL_STRING("clk_-1", ceventstr(-1));
48 }
49