Skip to content

Commit

Permalink
Add sol_tsuite_init2() test case #2
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 5, 2019
1 parent 1cccbd5 commit f38a217
Showing 1 changed file with 41 additions and 5 deletions.
46 changes: 41 additions & 5 deletions test/test.t.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,35 @@
/*
* DESC_INIT_01 - description for sol_tsuite_init() unit test #1
*/
#define DESC_INIT_01 "sol_tsuite_init() should through SOL_ERNO_PTR when" \
#define DESC_INIT_01 "sol_tsuite_init() should throw SOL_ERNO_PTR when" \
" passed a null pointer for @tsuite"



/*
* DESC_INIT2_01 - description for sol_tsuite_init2() unit test #1
*/
#define DESC_INIT2_01 "sol_tsuite_init2() should through SOL_ERNO_PTR when" \
#define DESC_INIT2_01 "sol_tsuite_init2() should throw SOL_ERNO_PTR when" \
" passed a null pointer for @tsuite"




/*
* DESC_INIT2_02 - description for sol_tsuite_init2() unit test #2
*/
#define DESC_INIT2_02 "sol_tsuite_init2() should throw SOL_ERNO_PTR when" \
" passed a null pointer for @tlog"




/*
* log_dummy() - dummy test suite logging callback
*/
static void
log_dummy(char const *desc,
sol_erno const erno
log_dummy(char const *desc, /* test case description */
sol_erno const erno /* test case error code */
)
{
}
Expand Down Expand Up @@ -78,7 +91,7 @@ test_init_01(void)


/*
* test_init_02() - sol_tsuite_init2() unit test #1
* test_init2_01() - sol_tsuite_init2() unit test #1
*/
static sol_erno
test_init2_01(void)
Expand All @@ -97,6 +110,28 @@ test_init2_01(void)



/*
* test_init2_02() - sol_tsuite_init2() unit test #1
*/
static sol_erno
test_init2_02(void)
{
auto sol_tsuite ts; /* dummy test suite */

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

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




/*
* __sol_tsuite_test() - declared in sol/test/suite.h
*/
Expand All @@ -119,6 +154,7 @@ __sol_tsuite_test(sol_tlog *log,
/* register test cases */
sol_try (sol_tsuite_register (ts, test_init_01, DESC_INIT_01));
sol_try (sol_tsuite_register (ts, test_init2_01, DESC_INIT2_01));
sol_try (sol_tsuite_register (ts, test_init2_02, DESC_INIT2_02));

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

0 comments on commit f38a217

Please sign in to comment.