perror_tc.c 477 B

12345678910111213141516171819202122232425
  1. #include <stdio.h>
  2. static int perror_entry(void)
  3. {
  4. FILE *stream;
  5. stream = fopen( "nulltest.txt", "r" );
  6. if(stream == NULL)
  7. {
  8. printf("perror test:");
  9. perror("nulltest.txt");
  10. }
  11. return 0;
  12. }
  13. #include <utest.h>
  14. static void test_perror(void)
  15. {
  16. uassert_int_equal(perror_entry(), 0);
  17. }
  18. static void testcase(void)
  19. {
  20. UTEST_UNIT_RUN(test_perror);
  21. }
  22. UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10);