1 #include <stdio.h>
2 #include <string.h>
3 
ftell_entry(void)4 static int ftell_entry(void)
5 {
6     FILE *stream;
7     char str[] = "123456789";
8     int ret = 0;
9 
10     stream = fopen("fopen_file.txt","w");
11     if (stream == NULL)
12     {
13         perror("fopen");
14         ret = -1;
15     }
16     else
17     {
18         fprintf(stream, "%s",str);
19         if(ftell(stream) != strlen(str))
20         {
21             ret = -1;
22         }
23         fclose(stream);
24     }
25     return ret;
26 }
27 
28 #include <utest.h>
test_ftell(void)29 static void test_ftell(void)
30 {
31     uassert_int_equal(ftell_entry(), 0);
32 }
testcase(void)33 static void testcase(void)
34 {
35     UTEST_UNIT_RUN(test_ftell);
36 }
37 UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10);
38 
39