1 #include <stdio.h>
2 
fopen_entry(void)3 static int fopen_entry(void)
4 {
5     FILE *stream;
6     /* TODO: other mode fopen */
7     stream = fopen("fopen_file.txt","a+");
8     if (stream == NULL)
9     {
10         perror("fopen fail");
11         return -1;
12     }
13 
14     fclose(stream);
15     return 0;
16 }
17 
18 #include <utest.h>
test_fopen(void)19 static void test_fopen(void)
20 {
21     uassert_int_equal(fopen_entry(), 0);
22 }
testcase(void)23 static void testcase(void)
24 {
25     UTEST_UNIT_RUN(test_fopen);
26 }
27 UTEST_TC_EXPORT(testcase, "posix.stdio_h.fopen.c", RT_NULL, RT_NULL, 10);
28 
29