]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
da8ba721 | 2 | |
da8ba721 | 3 | #include <string.h> |
07630cea | 4 | #include <sys/socket.h> |
da8ba721 DM |
5 | |
6 | #include "macro.h" | |
07630cea | 7 | #include "string-util.h" |
da8ba721 DM |
8 | #include "util.h" |
9 | ||
96315188 | 10 | _unused_ |
c9f7b4d3 | 11 | static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len); |
da8ba721 | 12 | |
07630cea | 13 | #include "af-from-name.h" |
da8ba721 DM |
14 | #include "af-list.h" |
15 | #include "af-to-name.h" | |
da8ba721 DM |
16 | |
17 | int main(int argc, const char *argv[]) { | |
18 | ||
14cb109d | 19 | unsigned i; |
da8ba721 DM |
20 | |
21 | for (i = 0; i < ELEMENTSOF(af_names); i++) { | |
22 | if (af_names[i]) { | |
23 | assert_se(streq(af_to_name(i), af_names[i])); | |
24 | assert_se(af_from_name(af_names[i]) == (int) i); | |
25 | } | |
26 | } | |
27 | ||
28 | assert_se(af_to_name(af_max()) == NULL); | |
29 | assert_se(af_to_name(-1) == NULL); | |
acf4d158 YW |
30 | assert_se(af_from_name("huddlduddl") == -EINVAL); |
31 | assert_se(af_from_name("") == -EINVAL); | |
da8ba721 DM |
32 | |
33 | return 0; | |
07630cea | 34 | } |