remove_tc.c 638 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include <stdio.h>
  2. static int remove_entry(void)
  3. {
  4. FILE *stream;
  5. stream = fopen("fopen_file.txt","w");
  6. if(stream)
  7. {
  8. fclose(stream);
  9. remove("fopen_file.txt");
  10. stream = fopen("fopen_file.txt","r");
  11. if(stream)
  12. {
  13. fclose(stream);
  14. return -1;
  15. }
  16. }
  17. else
  18. {
  19. return -1;
  20. }
  21. return 0;
  22. }
  23. #include <utest.h>
  24. static void test_remove(void)
  25. {
  26. uassert_int_equal(remove_entry(), 0);
  27. }
  28. static void testcase(void)
  29. {
  30. UTEST_UNIT_RUN(test_remove);
  31. }
  32. UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10);