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