]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/test/test-af-list.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd
5 Copyright 2015 Daniel Mack
9 #include <sys/socket.h>
12 #include "string-util.h"
16 static const struct af_name
* lookup_af(register const char *str
, register GPERF_LEN_TYPE len
);
18 #include "af-from-name.h"
20 #include "af-to-name.h"
22 int main(int argc
, const char *argv
[]) {
26 for (i
= 0; i
< ELEMENTSOF(af_names
); i
++) {
28 assert_se(streq(af_to_name(i
), af_names
[i
]));
29 assert_se(af_from_name(af_names
[i
]) == (int) i
);
33 assert_se(af_to_name(af_max()) == NULL
);
34 assert_se(af_to_name(-1) == NULL
);
35 assert_se(af_from_name("huddlduddl") == AF_UNSPEC
);
36 assert_se(af_from_name("") == AF_UNSPEC
);