Index: sys/netinet/libalias/tests/Makefile =================================================================== --- /dev/null +++ sys/netinet/libalias/tests/Makefile @@ -0,0 +1,11 @@ +# $FreeBSD$ + +.include + +ATF_TESTS_C+= aliasdb_test + +SRCS.aliasdb_test= aliasdb_test.c + +LIBADD+= alias + +.include Index: sys/netinet/libalias/tests/aliasdb_test.c =================================================================== --- /dev/null +++ sys/netinet/libalias/tests/aliasdb_test.c @@ -0,0 +1,29 @@ +#include +#include + +/* global variable to allow cleanup after errors */ +static struct libalias *la = NULL; + +ATF_TC_WITH_CLEANUP(init); +ATF_TC_HEAD(init, env) +{ + atf_tc_set_md_var(env, "desc", "Create an instance"); +} +ATF_TC_BODY(init, dummy) +{ + ATF_CHECK_MSG(la == NULL, "Global variable la not clean."); + la = LibAliasInit(NULL); + ATF_CHECK_MSG(la != NULL, "Creating an instance failed."); +} +ATF_TC_CLEANUP(init, dummy) +{ + LibAliasUninit(la); + la = NULL; +} + +ATF_TP_ADD_TCS(aliasdb) +{ + ATF_TP_ADD_TC(aliasdb, init); + + return atf_no_error(); +}