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