]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-af-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
4 #include <sys/socket.h>
7 #include "string-util.h"
11 static const struct af_name
* lookup_af(register const char *str
, register GPERF_LEN_TYPE len
);
13 #include "af-from-name.h"
15 #include "af-to-name.h"
17 int main(int argc
, const char *argv
[]) {
21 for (i
= 0; i
< ELEMENTSOF(af_names
); i
++) {
23 assert_se(streq(af_to_name(i
), af_names
[i
]));
24 assert_se(af_from_name(af_names
[i
]) == (int) i
);
28 assert_se(af_to_name(af_max()) == NULL
);
29 assert_se(af_to_name(-1) == NULL
);
30 assert_se(af_from_name("huddlduddl") == -EINVAL
);
31 assert_se(af_from_name("") == -EINVAL
);