diff --git a/test/ts-log.c b/test/ts-log.c index 5db1ab2..570e6cf 100644 --- a/test/ts-log.c +++ b/test/ts-log.c @@ -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" \ @@ -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 */ @@ -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));