2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2015-07-30 21:07:25 +02:00
|
|
|
|
2015-10-24 22:58:24 +02:00
|
|
|
#include <sys/socket.h>
|
2015-07-30 21:07:25 +02:00
|
|
|
|
|
|
|
#include "macro.h"
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "string-util.h"
|
2015-07-30 21:07:25 +02:00
|
|
|
#include "util.h"
|
|
|
|
|
2017-05-04 22:47:26 +02:00
|
|
|
_unused_
|
2017-01-10 08:39:05 +01:00
|
|
|
static const struct af_name* lookup_af(register const char *str, register GPERF_LEN_TYPE len);
|
2015-07-30 21:07:25 +02:00
|
|
|
|
2015-10-24 22:58:24 +02:00
|
|
|
#include "af-from-name.h"
|
2015-07-30 21:07:25 +02:00
|
|
|
#include "af-list.h"
|
|
|
|
#include "af-to-name.h"
|
|
|
|
|
|
|
|
int main(int argc, const char *argv[]) {
|
|
|
|
|
2018-10-19 20:00:46 +02:00
|
|
|
unsigned i;
|
2015-07-30 21:07:25 +02:00
|
|
|
|
|
|
|
for (i = 0; i < ELEMENTSOF(af_names); i++) {
|
|
|
|
if (af_names[i]) {
|
|
|
|
assert_se(streq(af_to_name(i), af_names[i]));
|
|
|
|
assert_se(af_from_name(af_names[i]) == (int) i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
assert_se(af_to_name(af_max()) == NULL);
|
|
|
|
assert_se(af_to_name(-1) == NULL);
|
2018-11-28 09:54:04 +01:00
|
|
|
assert_se(af_from_name("huddlduddl") == -EINVAL);
|
|
|
|
assert_se(af_from_name("") == -EINVAL);
|
2015-07-30 21:07:25 +02:00
|
|
|
|
|
|
|
return 0;
|
2015-10-24 22:58:24 +02:00
|
|
|
}
|