testcase/kernel/tc_libc_timer : Add CONFIG specific buffer check line
If CONFIG_LIBC_LOCALTIME or CONFIG_TIME_EXTENDED is turned on.
The strftime function that receives the %a and %A parameter stores the value associated with st_time.tm_wday in buffer instead of "Day".
So I added a #if line to handle this.
@@ -321,6 +321,9 @@ static void tc_libc_timer_strftime(void)
st_time.tm_mday = 19;
st_time.tm_mon = 5;
st_time.tm_year = 2017 - TM_YEAR_BASE;
+#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
+ st_time.tm_wday = 5;
+#endif
/* Verifying year and month filled in time structure.
* time structure has month in range 0-11,
@@ -329,13 +332,25 @@ static void tc_libc_timer_strftime(void)
/* Check the zero value */
TC_ASSERT_EQ("strftime", strftime(buffer, 0, "return_0_check", &st_time), 0);
- /* Check the three-letter abbreviation for the day of the week */
+ /* Check the string used as an input parameter */
strftime(buffer, BUFF_SIZE, "a", &st_time);
TC_ASSERT_EQ("strftime", strncmp(buffer, "a", strlen("a") + 1), 0);
- /* Check the full name for the day of the week */
+ /* Check the three-letter abbreviation for the day of the week */
strftime(buffer, BUFF_SIZE, "%a", &st_time);
+#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
+ TC_ASSERT_EQ("strftime", strncmp(buffer, "Fri", strlen("Fri") + 1), 0);
+#else
TC_ASSERT_EQ("strftime", strncmp(buffer, "Day", strlen("Day") + 1), 0);
+#endif
+
+ /* Check the full name for the day of the week */
+ strftime(buffer, BUFF_SIZE, "%A", &st_time);
+#if defined(CONFIG_LIBC_LOCALTIME) || defined(CONFIG_TIME_EXTENDED)
+ TC_ASSERT_EQ("strftime", strncmp(buffer, "Friday", strlen("Friday") + 1), 0);
+#else
+ TC_ASSERT_EQ("strftime", strncmp(buffer, "Day", strlen("Day") + 1), 0);
+#endif
/* Check the full month name */
strftime(buffer, BUFF_SIZE, "%B", &st_time);
