]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-arphrd-list.c
resolve: allow configurable bind address
[thirdparty/systemd.git] / src / test / test-arphrd-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #include <linux/if_arp.h>
4
5 #include "string-util.h"
6 #include "tests.h"
7
8 #include "arphrd-list.h"
9
10 int main(int argc, const char *argv[]) {
11 test_setup_logging(LOG_INFO);
12
13 for (int i = 0; i <= ARPHRD_VOID + 1; i++) {
14 const char *name;
15
16 name = arphrd_to_name(i);
17 if (name) {
18 log_info("%i: %s", i, name);
19
20 assert_se(arphrd_from_name(name) == i);
21 }
22 }
23
24 assert_se(arphrd_to_name(ARPHRD_VOID + 1) == NULL);
25 assert_se(arphrd_from_name("huddlduddl") == -EINVAL);
26 assert_se(arphrd_from_name("") == -EINVAL);
27
28 return 0;
29 }