1
0

fopen_tc.c 499 B

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