le_tc/kernel: add corner cases for environment TC's
This patch adds left over cases for API's:
get_environ_ptr()
getenv()
@@ -56,6 +56,9 @@ static void tc_environ_setenv_getenv_unsetenv(void)
ret_chk = setenv(psz_name, psz_value, 1);
TC_ASSERT_EQ_CLEANUP("setenv", ret_chk, OK, clearenv());
+ psz_getvalue = getenv(NULL);
+ TC_ASSERT_EQ("getenv", psz_getvalue, NULL);
+
psz_getvalue = getenv(psz_name);
TC_ASSERT_NEQ_CLEANUP("getenv", psz_getvalue, NULL, clearenv());
TC_ASSERT_EQ_CLEANUP("getenv", strcmp(psz_getvalue, psz_value), 0, clearenv());
@@ -144,6 +147,7 @@ static void tc_environ_putenv(void)
{
int ret_chk;
char *psz_getvalue = NULL;
+
/* adding enviroment variable */
ret_chk = putenv("PATH=C:");
@@ -185,6 +189,7 @@ static void tc_environ_get_environ_ptr(void)
size_t cmp_size = 0;
char *env_ptr;
int env_idx;
+ int ret_chk;
char env_name[ENV_TEST_LEN];
char env_val[ENV_TEST_LEN];
@@ -208,7 +213,12 @@ static void tc_environ_get_environ_ptr(void)
env_ptr += strlen(env_ptr) + 1;
}
- clearenv();
+ ret_chk = clearenv();
+ TC_ASSERT_EQ("clearenv", ret_chk, OK);
+
+ env_ptr = get_environ_ptr(&env_size);
+ TC_ASSERT_EQ("get_environ_ptr", env_ptr, NULL);
+
TC_SUCCESS_RESULT();
}
