]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/test/test-arphrd-list.c
calendarspec: rename free_chain() to chain_free()
[thirdparty/systemd.git] / src / test / test-arphrd-list.c
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
da8ba721
DM
2
3#include <net/if_arp.h>
4#include <string.h>
5
6#include "macro.h"
0b7d48f5 7#include "missing_network.h"
07630cea 8#include "string-util.h"
da8ba721 9
cfe5b071 10_unused_ \
c9f7b4d3 11static const struct arphrd_name* lookup_arphrd(register const char *str, register GPERF_LEN_TYPE len);
da8ba721 12
07630cea 13#include "arphrd-from-name.h"
da8ba721
DM
14#include "arphrd-list.h"
15#include "arphrd-to-name.h"
da8ba721
DM
16
17int main(int argc, const char *argv[]) {
18
14cb109d 19 unsigned i;
da8ba721
DM
20
21 for (i = 1; i < ELEMENTSOF(arphrd_names); i++) {
22 if (arphrd_names[i]) {
23 assert_se(streq(arphrd_to_name(i), arphrd_names[i]));
24 assert_se(arphrd_from_name(arphrd_names[i]) == (int) i);
25 }
26 }
27
28 assert_se(arphrd_to_name(arphrd_max()) == NULL);
29 assert_se(arphrd_to_name(0) == NULL);
acf4d158
YW
30 assert_se(arphrd_from_name("huddlduddl") == -EINVAL);
31 assert_se(arphrd_from_name("") == -EINVAL);
da8ba721
DM
32
33 return 0;
07630cea 34}