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