]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-arphrd-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2015 Daniel Mack
6 #include <net/if_arp.h>
10 #include "string-util.h"
14 static const struct arphrd_name
* lookup_arphrd(register const char *str
, register GPERF_LEN_TYPE len
);
16 #include "arphrd-from-name.h"
17 #include "arphrd-list.h"
18 #include "arphrd-to-name.h"
20 int main(int argc
, const char *argv
[]) {
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
);
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);
34 assert_se(arphrd_from_name("") == 0);