From: Sebastian Harl Date: Wed, 28 Aug 2013 19:16:47 +0000 (+0200) Subject: t/libsysdb_test: Use a list of test-suite creators. X-Git-Tag: sysdb-0.1.0~363 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0aed0a0fadb607a04c3f9cb15e4cb49262c115d9;p=sysdb.git t/libsysdb_test: Use a list of test-suite creators. … rather than adding a new block for each new test-suite. --- diff --git a/t/libsysdb_test.c b/t/libsysdb_test.c index 79ba421..2351f19 100644 --- a/t/libsysdb_test.c +++ b/t/libsysdb_test.c @@ -29,27 +29,29 @@ #include "libsysdb_test.h" +typedef Suite *(*suite_creator)(void); + int main(void) { int failed = 0; - - SRunner *sr; - Suite *s; - - /* t/utils/llist_test */ - s = util_llist_suite(); - sr = srunner_create(s); - srunner_run_all(sr, CK_NORMAL); - failed += srunner_ntests_failed(sr); - srunner_free(sr); - - /* t/utils/dbi_test */ - s = util_dbi_suite(); - sr = srunner_create(s); - srunner_run_all(sr, CK_NORMAL); - failed += srunner_ntests_failed(sr); - srunner_free(sr); + size_t i; + + suite_creator creators[] = { + util_llist_suite, + util_dbi_suite, + }; + + for (i = 0; i < SDB_STATIC_ARRAY_LEN(creators); ++i) { + SRunner *sr; + Suite *s; + + s = creators[i](); + sr = srunner_create(s); + srunner_run_all(sr, CK_NORMAL); + failed += srunner_ntests_failed(sr); + srunner_free(sr); + } return failed; } /* main */