<sys/socket.h>: turn off MSG_NOSIGNAL
[minix3.git] / tests / include / t_inttypes.c
blobd713615ea0db779a545776afa70be3a9221972b9
1 /* $NetBSD: t_inttypes.c,v 1.3 2013/10/19 17:44:37 christos Exp $ */
3 /*-
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
29 #include <inttypes.h>
30 #include <stdio.h>
31 #include <stdlib.h>
33 #include <atf-c.h>
35 ATF_TC_WITHOUT_HEAD(int_fmtio);
36 ATF_TC_BODY(int_fmtio, tc)
38 char buf[64];
40 int8_t i8 = 0;
41 int16_t i16 = 0;
42 int32_t i32 = 0;
43 int64_t i64 = 0;
44 int_least8_t il8 = 0;
45 int_least16_t il16 = 0;
46 int_least32_t il32 = 0;
47 int_least64_t il64 = 0;
48 int_fast8_t if8 = 0;
49 int_fast16_t if16 = 0;
50 int_fast32_t if32 = 0;
51 int_fast64_t if64 = 0;
52 intmax_t im = 0;
53 intptr_t ip = 0;
54 uint8_t ui8 = 0;
55 uint16_t ui16 = 0;
56 uint32_t ui32 = 0;
57 uint64_t ui64 = 0;
58 uint_least8_t uil8 = 0;
59 uint_least16_t uil16 = 0;
60 uint_least32_t uil32 = 0;
61 uint_least64_t uil64 = 0;
62 uint_fast8_t uif8 = 0;
63 uint_fast16_t uif16 = 0;
64 uint_fast32_t uif32 = 0;
65 uint_fast64_t uif64 = 0;
66 uintmax_t uim = 0;
67 uintptr_t uip = 0;
69 #define PRINT(fmt, var) \
70 snprintf(buf, sizeof(buf), "%" fmt, var)
71 #define SCAN(fmt, var) \
72 sscanf(buf, "%" fmt, &var)
74 PRINT(PRId8, i8);
75 PRINT(PRId16, i16);
76 PRINT(PRId32, i32);
77 PRINT(PRId64, i64);
78 PRINT(PRIdLEAST8, il8);
79 PRINT(PRIdLEAST16, il16);
80 PRINT(PRIdLEAST32, il32);
81 PRINT(PRIdLEAST64, il64);
82 PRINT(PRIdFAST8, if8);
83 PRINT(PRIdFAST16, if16);
84 PRINT(PRIdFAST32, if32);
85 PRINT(PRIdFAST64, if64);
86 PRINT(PRIdMAX, im);
87 PRINT(PRIdPTR, ip);
89 PRINT(PRIi8, i8);
90 PRINT(PRIi16, i16);
91 PRINT(PRIi32, i32);
92 PRINT(PRIi64, i64);
93 PRINT(PRIiLEAST8, il8);
94 PRINT(PRIiLEAST16, il16);
95 PRINT(PRIiLEAST32, il32);
96 PRINT(PRIiLEAST64, il64);
97 PRINT(PRIiFAST8, if8);
98 PRINT(PRIiFAST16, if16);
99 PRINT(PRIiFAST32, if32);
100 PRINT(PRIiFAST64, if64);
101 PRINT(PRIiMAX, im);
102 PRINT(PRIiPTR, ip);
104 PRINT(PRIo8, ui8);
105 PRINT(PRIo16, ui16);
106 PRINT(PRIo32, ui32);
107 PRINT(PRIo64, ui64);
108 PRINT(PRIoLEAST8, uil8);
109 PRINT(PRIoLEAST16, uil16);
110 PRINT(PRIoLEAST32, uil32);
111 PRINT(PRIoLEAST64, uil64);
112 PRINT(PRIoFAST8, uif8);
113 PRINT(PRIoFAST16, uif16);
114 PRINT(PRIoFAST32, uif32);
115 PRINT(PRIoFAST64, uif64);
116 PRINT(PRIoMAX, uim);
117 PRINT(PRIoPTR, uip);
119 PRINT(PRIu8, ui8);
120 PRINT(PRIu16, ui16);
121 PRINT(PRIu32, ui32);
122 PRINT(PRIu64, ui64);
123 PRINT(PRIuLEAST8, uil8);
124 PRINT(PRIuLEAST16, uil16);
125 PRINT(PRIuLEAST32, uil32);
126 PRINT(PRIuLEAST64, uil64);
127 PRINT(PRIuFAST8, uif8);
128 PRINT(PRIuFAST16, uif16);
129 PRINT(PRIuFAST32, uif32);
130 PRINT(PRIuFAST64, uif64);
131 PRINT(PRIuMAX, uim);
132 PRINT(PRIuPTR, uip);
134 PRINT(PRIx8, ui8);
135 PRINT(PRIx16, ui16);
136 PRINT(PRIx32, ui32);
137 PRINT(PRIx64, ui64);
138 PRINT(PRIxLEAST8, uil8);
139 PRINT(PRIxLEAST16, uil16);
140 PRINT(PRIxLEAST32, uil32);
141 PRINT(PRIxLEAST64, uil64);
142 PRINT(PRIxFAST8, uif8);
143 PRINT(PRIxFAST16, uif16);
144 PRINT(PRIxFAST32, uif32);
145 PRINT(PRIxFAST64, uif64);
146 PRINT(PRIxMAX, uim);
147 PRINT(PRIxPTR, uip);
149 PRINT(PRIX8, ui8);
150 PRINT(PRIX16, ui16);
151 PRINT(PRIX32, ui32);
152 PRINT(PRIX64, ui64);
153 PRINT(PRIXLEAST8, uil8);
154 PRINT(PRIXLEAST16, uil16);
155 PRINT(PRIXLEAST32, uil32);
156 PRINT(PRIXLEAST64, uil64);
157 PRINT(PRIXFAST8, uif8);
158 PRINT(PRIXFAST16, uif16);
159 PRINT(PRIXFAST32, uif32);
160 PRINT(PRIXFAST64, uif64);
161 PRINT(PRIXMAX, uim);
162 PRINT(PRIXPTR, uip);
165 SCAN(SCNd8, i8);
166 SCAN(SCNd16, i16);
167 SCAN(SCNd32, i32);
168 SCAN(SCNd64, i64);
169 SCAN(SCNdLEAST8, il8);
170 SCAN(SCNdLEAST16, il16);
171 SCAN(SCNdLEAST32, il32);
172 SCAN(SCNdLEAST64, il64);
173 SCAN(SCNdFAST8, if8);
174 SCAN(SCNdFAST16, if16);
175 SCAN(SCNdFAST32, if32);
176 SCAN(SCNdFAST64, if64);
177 SCAN(SCNdMAX, im);
178 SCAN(SCNdPTR, ip);
180 SCAN(SCNi8, i8);
181 SCAN(SCNi16, i16);
182 SCAN(SCNi32, i32);
183 SCAN(SCNi64, i64);
184 SCAN(SCNiLEAST8, il8);
185 SCAN(SCNiLEAST16, il16);
186 SCAN(SCNiLEAST32, il32);
187 SCAN(SCNiLEAST64, il64);
188 SCAN(SCNiFAST8, if8);
189 SCAN(SCNiFAST16, if16);
190 SCAN(SCNiFAST32, if32);
191 SCAN(SCNiFAST64, if64);
192 SCAN(SCNiMAX, im);
193 SCAN(SCNiPTR, ip);
195 SCAN(SCNo8, ui8);
196 SCAN(SCNo16, ui16);
197 SCAN(SCNo32, ui32);
198 SCAN(SCNo64, ui64);
199 SCAN(SCNoLEAST8, uil8);
200 SCAN(SCNoLEAST16, uil16);
201 SCAN(SCNoLEAST32, uil32);
202 SCAN(SCNoLEAST64, uil64);
203 SCAN(SCNoFAST8, uif8);
204 SCAN(SCNoFAST16, uif16);
205 SCAN(SCNoFAST32, uif32);
206 SCAN(SCNoFAST64, uif64);
207 SCAN(SCNoMAX, uim);
208 SCAN(SCNoPTR, uip);
210 SCAN(SCNu8, ui8);
211 SCAN(SCNu16, ui16);
212 SCAN(SCNu32, ui32);
213 SCAN(SCNu64, ui64);
214 SCAN(SCNuLEAST8, uil8);
215 SCAN(SCNuLEAST16, uil16);
216 SCAN(SCNuLEAST32, uil32);
217 SCAN(SCNuLEAST64, uil64);
218 SCAN(SCNuFAST8, uif8);
219 SCAN(SCNuFAST16, uif16);
220 SCAN(SCNuFAST32, uif32);
221 SCAN(SCNuFAST64, uif64);
222 SCAN(SCNuMAX, uim);
223 SCAN(SCNuPTR, uip);
225 SCAN(SCNx8, ui8);
226 SCAN(SCNx16, ui16);
227 SCAN(SCNx32, ui32);
228 SCAN(SCNx64, ui64);
229 SCAN(SCNxLEAST8, uil8);
230 SCAN(SCNxLEAST16, uil16);
231 SCAN(SCNxLEAST32, uil32);
232 SCAN(SCNxLEAST64, uil64);
233 SCAN(SCNxFAST8, uif8);
234 SCAN(SCNxFAST16, uif16);
235 SCAN(SCNxFAST32, uif32);
236 SCAN(SCNxFAST64, uif64);
237 SCAN(SCNxMAX, uim);
238 SCAN(SCNxPTR, uip);
240 #undef SCAN
241 #undef PRINT
244 ATF_TP_ADD_TCS(tp)
247 ATF_TP_ADD_TC(tp, int_fmtio);
249 return atf_no_error();