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