Skip to content

Commit

Permalink
Add unit test #2 for sol_tsuite_pass()
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Chakravarti <abhishek@taranjali.org>
  • Loading branch information
achakravarti committed Feb 6, 2019
1 parent 901e5ce commit fd80584
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions test/test.t.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@



/*
* DESC_PASS_02 - description for sol_tsuite_pass() unit test #2
*/
#define DESC_PASS_02 "sol_tsuite_pass() should throw SOL_ERNO_PTR when passed" \
" a null pointer for @pass"




/*
* tlog_dummy() - dummy test suite logging callback
*/
Expand Down Expand Up @@ -280,8 +289,31 @@ test_pass_01(void)

SOL_TRY:
/* sol_tsuite_pass() should fail with SOL_ERNO_PTR */
sol_try (sol_tsuite_init2 (&ts, tlog_dummy));
sol_try (sol_tsuite_pass (0, &pass));
sol_try (sol_tsuite_init2 (&ts, tlog_dummy));
sol_try (sol_tsuite_pass (0, &pass));

SOL_CATCH:
/* check test condition described by DESC_REGISTER_01 */
return SOL_ERNO_PTR == sol_erno_now ()
? SOL_ERNO_NULL
: SOL_ERNO_TEST;
}




/*
* test_pass_02() - sol_tsuite_pass() unit test #2
*/
static sol_erno
test_pass_02(void)
{
auto sol_tsuite ts; /* dummy test suite */

SOL_TRY:
/* sol_tsuite_pass() should fail with SOL_ERNO_PTR */
sol_try (sol_tsuite_init2 (&ts, tlog_dummy));
sol_try (sol_tsuite_pass (&ts, 0));

SOL_CATCH:
/* check test condition described by DESC_REGISTER_01 */
Expand Down Expand Up @@ -321,6 +353,7 @@ __sol_tsuite_test(sol_tlog *log,
sol_try (sol_tsuite_register (ts, test_register_03, DESC_REGISTER_03));
sol_try (sol_tsuite_register (ts, test_register_04, DESC_REGISTER_04));
sol_try (sol_tsuite_register (ts, test_pass_01, DESC_PASS_01));
sol_try (sol_tsuite_register (ts, test_pass_02, DESC_PASS_02));

/* execute test cases */
sol_try (sol_tsuite_exec (ts));
Expand Down

0 comments on commit fd80584

Please sign in to comment.