diff --git a/src/tests/server_tests.c b/src/tests/server_tests.c index d7e3c11da4162e4d99077cc972cbaca72d17fa84..242731bf5ccfbe5597b8b90821eb17ad02d85029 100644 --- a/src/tests/server_tests.c +++ b/src/tests/server_tests.c @@ -1,8 +1,8 @@ #include "server/server.h" #include "tap_unit.h" -int server_tests_count(int argc, char * argv[]); -int server_tests_run(int argc, char * argv[]); +static int server_tests_count(int argc, char * argv[]); +static int server_tests_run(int argc, char * argv[]); /* * Unit API. @@ -45,7 +45,7 @@ int test_server_destroy(cute_server* s) } /*! API: return number of tests. */ -int server_tests_count(int argc, char * argv[]) +static int server_tests_count(int argc, char * argv[]) { return SERVER_TEST_COUNT + 1; } @@ -56,7 +56,7 @@ static void interrupt_handle(int s) } /*! API: run tests. */ -int server_tests_run(int argc, char * argv[]) +static int server_tests_run(int argc, char * argv[]) { cute_server* server = 0; int ret = 0; diff --git a/src/tests/template_tests.c b/src/tests/template_tests.c index 2dd4bef5b802f24a42105048f4aaa2e2b54ddf77..ca097f43974924a63188307748c9fc359134d78b 100644 --- a/src/tests/template_tests.c +++ b/src/tests/template_tests.c @@ -1,20 +1,41 @@ #include "tap_unit.h" +/* This is unit test template. + Implement two mandatory functions below, + name them accordingly and export unit API + via global variable of "unit_api". + + Add the exported variable into the list + "unit_api* tests[]" in src/tests/main.c + + There is no header file, all modules *.c files + are included directly into src/tests/main.c + + */ + /* Unit implementation */ -int TEMPLATE_tests_count(int argc, char *argv[]) + +/*! This helper routine should report number of + * scheduled tests for given parameters. + */ +static int TEMPLATE_tests_count(int argc, char *argv[]) { return 1; } -int TEMPLATE_tests_run(int argc, char *argv[]) +/*! Run all scheduled tests for given parameters. + */ +static int TEMPLATE_tests_run(int argc, char *argv[]) { ok(1 == 1, "dummy test"); return 0; } -/* Exported unit API. */ +/*! Exported unit API for later incorporation. + * Name must be unique for each module. + */ unit_api TEMPLATE_tests_api = { - "TEMPLATE unit", - &TEMPLATE_tests_count, - &TEMPLATE_tests_run + "TEMPLATE unit", //! Unit name + &TEMPLATE_tests_count, //! Count scheduled tests + &TEMPLATE_tests_run //! Run scheduled tests };