1 #include <stdio.h>
2 #include <string.h>
3 
sscanf_entry(void)4 static int sscanf_entry(void)
5 {
6     int day, year;
7     char weekday[20], month[20], dtm[100];
8 
9     strcpy( dtm, "Friday January 1 2021" );
10     sscanf( dtm, "%s %s %d  %d", weekday, month, &day, &year );
11 
12     if(strcmp(month,"January") || strcmp(weekday,"Friday")
13         || (year != 2021) ||(day != 1))
14     {
15         return -1;
16     }
17     return 0;
18 }
19 
20 #include <utest.h>
test_sscanf(void)21 static void test_sscanf(void)
22 {
23     uassert_int_equal(sscanf_entry(), 0);
24 }
testcase(void)25 static void testcase(void)
26 {
27     UTEST_UNIT_RUN(test_sscanf);
28 }
29 UTEST_TC_EXPORT(testcase, "posix.stdio_h.sscanf.c", RT_NULL, RT_NULL, 10);
30 
31