le_tc/kernel: add corner cases for clock TC's
This patch adds left over cases for API's:
clock_initialize()
clock_gettime()
clock_settime()
const long double l_day = 86400;
extern struct timespec g_basetime;
+#define CLOCK_ERR 2
#define SEC_PER_MIN ((time_t)60)
#define SEC_PER_HOUR ((time_t)60 * SEC_PER_MIN)
#define SEC_PER_DAY ((time_t)24 * SEC_PER_HOUR)
@@ -85,6 +86,10 @@ static void tc_clock_clock_set_get_time(void)
struct timespec stime;
struct timespec gtime;
+ ret_chk = clock_gettime(CLOCK_ERR, &stime);
+ TC_ASSERT_EQ("clock_gettime", ret_chk, ERROR);
+ TC_ASSERT_EQ("clock_gettime", errno, EINVAL);
+
ret_chk = clock_gettime(CLOCK_REALTIME, &stime);
TC_ASSERT_EQ("clock_gettime", ret_chk, OK);
@@ -105,6 +110,10 @@ static void tc_clock_clock_set_get_time(void)
stime.tv_sec -= l_day; /* Setting original time to system */
+ ret_chk = clock_settime(CLOCK_ERR, &stime);
+ TC_ASSERT_EQ("clock_settime", ret_chk, ERROR);
+ TC_ASSERT_EQ("clock_settime", errno, EINVAL);
+
ret_chk = clock_settime(CLOCK_REALTIME, &stime);
TC_ASSERT_EQ("clock_setime", ret_chk, OK);
