Skip to content

Commit

Permalink
Add sol_log_open() unit test #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 Mar 6, 2019
1 parent 1c602ba commit c36940a
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/ts-log.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@



/*
* test_open1() - sol_log_open() unit test #1
*/
static sol_erno test_open1(void)
{
#define DESC_OPEN1 "sol_log_open() throws SOL_ERNO_STR is @path is" \
Expand All @@ -57,6 +60,32 @@ static sol_erno test_open1(void)



/*
* test_open2() - sol_log_open() unit test #2
*/
static sol_erno test_open2(void)
{
#define DESC_OPEN2 "sol_log_open() throws SOL_ERNO_STR is @path is" \
" a null string"

SOL_TRY:
/* set up test scenario */
sol_try (sol_log_open(""));

SOL_CATCH:
/* check test condition */
sol_erno_set(sol_erno_get() == SOL_ERNO_STR
? SOL_ERNO_NULL
: SOL_ERNO_TEST);

SOL_FINALLY:
sol_log_close();
return sol_erno_get();
}




/*
* __sol_tests_log() - declared in sol/test/suite.h
*/
Expand All @@ -76,6 +105,7 @@ extern sol_erno __sol_tests_log(sol_tlog *log,

/* register test cases */
sol_try (sol_tsuite_register(ts, &test_open1, DESC_OPEN1));
sol_try (sol_tsuite_register(ts, &test_open2, DESC_OPEN2));

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

0 comments on commit c36940a

Please sign in to comment.