diff --git a/test/test.t.c b/test/test.t.c index acc5844..8d1286a 100644 --- a/test/test.t.c +++ b/test/test.t.c @@ -66,6 +66,15 @@ +/* + * DESC_REGISTER_02 - description for sol_tsuite_register() unit test #2 + */ +#define DESC_REGISTER_02 "sol_tsuite_register() should throw SOL_ERNO_PTR" \ + " when passed a null pointer for @tcase" + + + + /* * tlog_dummy() - dummy test suite logging callback */ @@ -164,6 +173,29 @@ test_register_01(void) +/* + * test_register_02() - sol_tsuite_register() unit test #2 + */ +static sol_erno +test_register_02(void) +{ + auto sol_tsuite ts; /* dummy test suite */ + +SOL_TRY: + /* sol_tsuite_register() should fail with SOL_ERNO_PTR */ + sol_try (sol_tsuite_init2 (&ts, tlog_dummy)); + sol_try (sol_tsuite_register (&ts, 0, "Dummy")); + +SOL_CATCH: + /* check test condition described by DESC_REGISTER_01 */ + return SOL_ERNO_PTR == sol_erno_now () + ? SOL_ERNO_NULL + : SOL_ERNO_TEST; +} + + + + /* * __sol_tsuite_test() - declared in sol/test/suite.h */ @@ -188,6 +220,7 @@ __sol_tsuite_test(sol_tlog *log, sol_try (sol_tsuite_register (ts, test_init2_01, DESC_INIT2_01)); sol_try (sol_tsuite_register (ts, test_init2_02, DESC_INIT2_02)); sol_try (sol_tsuite_register (ts, test_register_01, DESC_REGISTER_01)); + sol_try (sol_tsuite_register (ts, test_register_02, DESC_REGISTER_02)); /* execute test cases */ sol_try (sol_tsuite_exec (ts));