]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-af-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 Copyright © 2015 Daniel Mack
7 #include <sys/socket.h>
10 #include "string-util.h"
14 static const struct af_name
* lookup_af(register const char *str
, register GPERF_LEN_TYPE len
);
16 #include "af-from-name.h"
18 #include "af-to-name.h"
20 int main(int argc
, const char *argv
[]) {
24 for (i
= 0; i
< ELEMENTSOF(af_names
); i
++) {
26 assert_se(streq(af_to_name(i
), af_names
[i
]));
27 assert_se(af_from_name(af_names
[i
]) == (int) i
);
31 assert_se(af_to_name(af_max()) == NULL
);
32 assert_se(af_to_name(-1) == NULL
);
33 assert_se(af_from_name("huddlduddl") == AF_UNSPEC
);
34 assert_se(af_from_name("") == AF_UNSPEC
);