ferror_tc.c 444 B

12345678910111213141516171819202122232425262728
  1. #include <stdio.h>
  2. static int ferror_entry(void)
  3. {
  4. int c;
  5. putc( 'c', stdin );
  6. if( ferror( stdin ) )
  7. {
  8. clearerr( stdin );
  9. }
  10. else
  11. {
  12. return -1;
  13. }
  14. return 0;
  15. }
  16. #include <utest.h>
  17. static void test_ferror(void)
  18. {
  19. uassert_int_equal(ferror_entry(), 0);
  20. }
  21. static void testcase(void)
  22. {
  23. UTEST_UNIT_RUN(test_ferror);
  24. }
  25. UTEST_TC_EXPORT(testcase, "posix.stdio_h.ferror.c", RT_NULL, RT_NULL, 10);