From c36940a15a65ab5faeb909f35a8b35dfb3d19ff3 Mon Sep 17 00:00:00 2001 From: Abhishek Chakravarti Date: Wed, 6 Mar 2019 15:07:30 +0530 Subject: [PATCH] Add sol_log_open() unit test #2 Signed-off-by: Abhishek Chakravarti --- test/ts-log.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) 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));