xref: /minix3/tests/include/t_netdb.c (revision 11be35a165022172ed3cea20f2b5df0307540b0e)
1*11be35a1SLionel Sambuc /*	$NetBSD: t_netdb.c,v 1.2 2011/04/25 20:51:14 njoly Exp $ */
2*11be35a1SLionel Sambuc 
3*11be35a1SLionel Sambuc /*-
4*11be35a1SLionel Sambuc  * Copyright (c) 2011 The NetBSD Foundation, Inc.
5*11be35a1SLionel Sambuc  * All rights reserved.
6*11be35a1SLionel Sambuc  *
7*11be35a1SLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
8*11be35a1SLionel Sambuc  * by Jukka Ruohonen.
9*11be35a1SLionel Sambuc  *
10*11be35a1SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11*11be35a1SLionel Sambuc  * modification, are permitted provided that the following conditions
12*11be35a1SLionel Sambuc  * are met:
13*11be35a1SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14*11be35a1SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15*11be35a1SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*11be35a1SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*11be35a1SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*11be35a1SLionel Sambuc  *
19*11be35a1SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*11be35a1SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*11be35a1SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*11be35a1SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*11be35a1SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*11be35a1SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*11be35a1SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*11be35a1SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*11be35a1SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*11be35a1SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*11be35a1SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
30*11be35a1SLionel Sambuc  */
31*11be35a1SLionel Sambuc #include <sys/cdefs.h>
32*11be35a1SLionel Sambuc __RCSID("$NetBSD: t_netdb.c,v 1.2 2011/04/25 20:51:14 njoly Exp $");
33*11be35a1SLionel Sambuc 
34*11be35a1SLionel Sambuc #include <atf-c.h>
35*11be35a1SLionel Sambuc #include <netdb.h>
36*11be35a1SLionel Sambuc 
37*11be35a1SLionel Sambuc ATF_TC(netdb_constants);
ATF_TC_HEAD(netdb_constants,tc)38*11be35a1SLionel Sambuc ATF_TC_HEAD(netdb_constants, tc)
39*11be35a1SLionel Sambuc {
40*11be35a1SLionel Sambuc 	atf_tc_set_md_var(tc, "descr", "Test constants in <netdb.h>");
41*11be35a1SLionel Sambuc }
42*11be35a1SLionel Sambuc 
ATF_TC_BODY(netdb_constants,tc)43*11be35a1SLionel Sambuc ATF_TC_BODY(netdb_constants, tc)
44*11be35a1SLionel Sambuc {
45*11be35a1SLionel Sambuc 	bool fail;
46*11be35a1SLionel Sambuc 
47*11be35a1SLionel Sambuc 	/*
48*11be35a1SLionel Sambuc 	 * The following definitions should be available
49*11be35a1SLionel Sambuc 	 * according to IEEE Std 1003.1-2008, issue 7.
50*11be35a1SLionel Sambuc 	 */
51*11be35a1SLionel Sambuc 	atf_tc_expect_fail("PR standards/44777");
52*11be35a1SLionel Sambuc 
53*11be35a1SLionel Sambuc 	fail = true;
54*11be35a1SLionel Sambuc 
55*11be35a1SLionel Sambuc #ifdef AI_PASSIVE
56*11be35a1SLionel Sambuc 	fail = false;
57*11be35a1SLionel Sambuc #endif
58*11be35a1SLionel Sambuc 	if (fail != false)
59*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_PASSIVE not defined");
60*11be35a1SLionel Sambuc 
61*11be35a1SLionel Sambuc 	fail = true;
62*11be35a1SLionel Sambuc 
63*11be35a1SLionel Sambuc #ifdef AI_CANONNAME
64*11be35a1SLionel Sambuc 	fail = false;
65*11be35a1SLionel Sambuc #endif
66*11be35a1SLionel Sambuc 	if (fail != false)
67*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_CANONNAME not defined");
68*11be35a1SLionel Sambuc 
69*11be35a1SLionel Sambuc 	fail = true;
70*11be35a1SLionel Sambuc 
71*11be35a1SLionel Sambuc #ifdef AI_NUMERICHOST
72*11be35a1SLionel Sambuc 	fail = false;
73*11be35a1SLionel Sambuc #endif
74*11be35a1SLionel Sambuc 	if (fail != false)
75*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_NUMERICHOST not defined");
76*11be35a1SLionel Sambuc 
77*11be35a1SLionel Sambuc 	fail = true;
78*11be35a1SLionel Sambuc 
79*11be35a1SLionel Sambuc #ifdef AI_NUMERICSERV
80*11be35a1SLionel Sambuc 	fail = false;
81*11be35a1SLionel Sambuc #endif
82*11be35a1SLionel Sambuc 	if (fail != false)
83*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_NUMERICSERV not defined");
84*11be35a1SLionel Sambuc 
85*11be35a1SLionel Sambuc 	fail = true;
86*11be35a1SLionel Sambuc 
87*11be35a1SLionel Sambuc #ifdef AI_V4MAPPED
88*11be35a1SLionel Sambuc 	fail = false;
89*11be35a1SLionel Sambuc #endif
90*11be35a1SLionel Sambuc 	if (fail != false)
91*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_V4MAPPED not defined");
92*11be35a1SLionel Sambuc 
93*11be35a1SLionel Sambuc 	fail = true;
94*11be35a1SLionel Sambuc 
95*11be35a1SLionel Sambuc #ifdef AI_ALL
96*11be35a1SLionel Sambuc 	fail = false;
97*11be35a1SLionel Sambuc #endif
98*11be35a1SLionel Sambuc 	if (fail != false)
99*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_ALL not defined");
100*11be35a1SLionel Sambuc 
101*11be35a1SLionel Sambuc 	fail = true;
102*11be35a1SLionel Sambuc 
103*11be35a1SLionel Sambuc #ifdef AI_ADDRCONFIG
104*11be35a1SLionel Sambuc 	fail = false;
105*11be35a1SLionel Sambuc #endif
106*11be35a1SLionel Sambuc 	if (fail != false)
107*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("AI_ADDRCONFIG not defined");
108*11be35a1SLionel Sambuc 
109*11be35a1SLionel Sambuc 	fail = true;
110*11be35a1SLionel Sambuc 
111*11be35a1SLionel Sambuc #ifdef NI_NOFQDN
112*11be35a1SLionel Sambuc 	fail = false;
113*11be35a1SLionel Sambuc #endif
114*11be35a1SLionel Sambuc 	if (fail != false)
115*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_NOFQDN not defined");
116*11be35a1SLionel Sambuc 
117*11be35a1SLionel Sambuc 	fail = true;
118*11be35a1SLionel Sambuc 
119*11be35a1SLionel Sambuc #ifdef NI_NUMERICHOST
120*11be35a1SLionel Sambuc 	fail = false;
121*11be35a1SLionel Sambuc #endif
122*11be35a1SLionel Sambuc 	if (fail != false)
123*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_NUMERICHOST not defined");
124*11be35a1SLionel Sambuc 
125*11be35a1SLionel Sambuc 	fail = true;
126*11be35a1SLionel Sambuc 
127*11be35a1SLionel Sambuc #ifdef NI_NAMEREQD
128*11be35a1SLionel Sambuc 	fail = false;
129*11be35a1SLionel Sambuc #endif
130*11be35a1SLionel Sambuc 	if (fail != false)
131*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_NAMEREQD not defined");
132*11be35a1SLionel Sambuc 
133*11be35a1SLionel Sambuc 	fail = true;
134*11be35a1SLionel Sambuc 
135*11be35a1SLionel Sambuc #ifdef NI_NUMERICSERV
136*11be35a1SLionel Sambuc 	fail = false;
137*11be35a1SLionel Sambuc #endif
138*11be35a1SLionel Sambuc 	if (fail != false)
139*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_NUMERICSERV not defined");
140*11be35a1SLionel Sambuc 
141*11be35a1SLionel Sambuc 	fail = true;
142*11be35a1SLionel Sambuc 
143*11be35a1SLionel Sambuc #ifdef NI_NUMERICSCOPE
144*11be35a1SLionel Sambuc 	fail = false;
145*11be35a1SLionel Sambuc #endif
146*11be35a1SLionel Sambuc 	if (fail != false)
147*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_NUMERICSCOPE not defined");
148*11be35a1SLionel Sambuc 
149*11be35a1SLionel Sambuc 	fail = true;
150*11be35a1SLionel Sambuc 
151*11be35a1SLionel Sambuc #ifdef NI_DGRAM
152*11be35a1SLionel Sambuc 	fail = false;
153*11be35a1SLionel Sambuc #endif
154*11be35a1SLionel Sambuc 	if (fail != false)
155*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("NI_DGRAM not defined");
156*11be35a1SLionel Sambuc 
157*11be35a1SLionel Sambuc 	fail = true;
158*11be35a1SLionel Sambuc 
159*11be35a1SLionel Sambuc #ifdef EAI_AGAIN
160*11be35a1SLionel Sambuc 	fail = false;
161*11be35a1SLionel Sambuc #endif
162*11be35a1SLionel Sambuc 	if (fail != false)
163*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_AGAIN not defined");
164*11be35a1SLionel Sambuc 
165*11be35a1SLionel Sambuc 	fail = true;
166*11be35a1SLionel Sambuc 
167*11be35a1SLionel Sambuc #ifdef EAI_BADFLAGS
168*11be35a1SLionel Sambuc 	fail = false;
169*11be35a1SLionel Sambuc #endif
170*11be35a1SLionel Sambuc 	if (fail != false)
171*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_BADFLAGS not defined");
172*11be35a1SLionel Sambuc 
173*11be35a1SLionel Sambuc 	fail = true;
174*11be35a1SLionel Sambuc 
175*11be35a1SLionel Sambuc #ifdef EAI_FAIL
176*11be35a1SLionel Sambuc 	fail = false;
177*11be35a1SLionel Sambuc #endif
178*11be35a1SLionel Sambuc 	if (fail != false)
179*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_FAIL not defined");
180*11be35a1SLionel Sambuc 
181*11be35a1SLionel Sambuc 	fail = true;
182*11be35a1SLionel Sambuc 
183*11be35a1SLionel Sambuc #ifdef EAI_FAMILY
184*11be35a1SLionel Sambuc 	fail = false;
185*11be35a1SLionel Sambuc #endif
186*11be35a1SLionel Sambuc 	if (fail != false)
187*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_FAMILY not defined");
188*11be35a1SLionel Sambuc 
189*11be35a1SLionel Sambuc 	fail = true;
190*11be35a1SLionel Sambuc 
191*11be35a1SLionel Sambuc #ifdef EAI_MEMORY
192*11be35a1SLionel Sambuc 	fail = false;
193*11be35a1SLionel Sambuc #endif
194*11be35a1SLionel Sambuc 	if (fail != false)
195*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_MEMORY not defined");
196*11be35a1SLionel Sambuc 
197*11be35a1SLionel Sambuc 	fail = true;
198*11be35a1SLionel Sambuc 
199*11be35a1SLionel Sambuc #ifdef EAI_NONAME
200*11be35a1SLionel Sambuc 	fail = false;
201*11be35a1SLionel Sambuc #endif
202*11be35a1SLionel Sambuc 	if (fail != false)
203*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_NONAME not defined");
204*11be35a1SLionel Sambuc 
205*11be35a1SLionel Sambuc 	fail = true;
206*11be35a1SLionel Sambuc 
207*11be35a1SLionel Sambuc #ifdef EAI_SERVICE
208*11be35a1SLionel Sambuc 	fail = false;
209*11be35a1SLionel Sambuc #endif
210*11be35a1SLionel Sambuc 	if (fail != false)
211*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_SERVICE not defined");
212*11be35a1SLionel Sambuc 
213*11be35a1SLionel Sambuc 	fail = true;
214*11be35a1SLionel Sambuc 
215*11be35a1SLionel Sambuc #ifdef EAI_SOCKTYPE
216*11be35a1SLionel Sambuc 	fail = false;
217*11be35a1SLionel Sambuc #endif
218*11be35a1SLionel Sambuc 	if (fail != false)
219*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_SOCKTYPE not defined");
220*11be35a1SLionel Sambuc 
221*11be35a1SLionel Sambuc 	fail = true;
222*11be35a1SLionel Sambuc 
223*11be35a1SLionel Sambuc #ifdef EAI_SYSTEM
224*11be35a1SLionel Sambuc 	fail = false;
225*11be35a1SLionel Sambuc #endif
226*11be35a1SLionel Sambuc 	if (fail != false)
227*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_SYSTEM not defined");
228*11be35a1SLionel Sambuc 
229*11be35a1SLionel Sambuc 	fail = true;
230*11be35a1SLionel Sambuc 
231*11be35a1SLionel Sambuc #ifdef EAI_OVERFLOW
232*11be35a1SLionel Sambuc 	fail = false;
233*11be35a1SLionel Sambuc #endif
234*11be35a1SLionel Sambuc 	if (fail != false)
235*11be35a1SLionel Sambuc 		atf_tc_fail_nonfatal("EAI_OVERFLOW not defined");
236*11be35a1SLionel Sambuc }
237*11be35a1SLionel Sambuc 
ATF_TP_ADD_TCS(tp)238*11be35a1SLionel Sambuc ATF_TP_ADD_TCS(tp)
239*11be35a1SLionel Sambuc {
240*11be35a1SLionel Sambuc 
241*11be35a1SLionel Sambuc 	ATF_TP_ADD_TC(tp, netdb_constants);
242*11be35a1SLionel Sambuc 
243*11be35a1SLionel Sambuc 	return atf_no_error();
244*11be35a1SLionel Sambuc }
245