fileno_tc.c 506 B

1234567891011121314151617181920212223242526
  1. #include <stdio.h>
  2. static int fdopen_entry(void)
  3. {
  4. int stdin_no = fileno(stdin);
  5. int stdout_no = fileno(stdout);
  6. int stderr_no = fileno(stderr);
  7. if((stdin_no == 0) && (stdout_no == 1) && (stderr_no == 2))
  8. {
  9. return 0;
  10. }
  11. return -1;
  12. }
  13. #include <utest.h>
  14. static void test_fdopen(void)
  15. {
  16. uassert_int_equal(fdopen_entry(), 0);
  17. }
  18. static void testcase(void)
  19. {
  20. UTEST_UNIT_RUN(test_fdopen);
  21. }
  22. UTEST_TC_EXPORT(testcase, "posix.stdio_h.fileno.c", RT_NULL, RT_NULL, 10);