]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-arphrd-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 #include <linux/if_arp.h>
7 #include "string-util.h"
10 static const struct arphrd_name
* lookup_arphrd(register const char *str
, register GPERF_LEN_TYPE len
);
12 #include "arphrd-from-name.h"
13 #include "arphrd-list.h"
14 #include "arphrd-to-name.h"
16 int main(int argc
, const char *argv
[]) {
20 for (i
= 1; i
< ELEMENTSOF(arphrd_names
); i
++) {
21 if (arphrd_names
[i
]) {
22 assert_se(streq(arphrd_to_name(i
), arphrd_names
[i
]));
23 assert_se(arphrd_from_name(arphrd_names
[i
]) == (int) i
);
27 assert_se(arphrd_to_name(arphrd_max()) == NULL
);
28 assert_se(arphrd_to_name(0) == NULL
);
29 assert_se(arphrd_from_name("huddlduddl") == -EINVAL
);
30 assert_se(arphrd_from_name("") == -EINVAL
);