summaryrefslogtreecommitdiff
path: root/examples/utest/testcases/posix/stdio_h/functions/ferror_tc.c
blob: 18084113c44c7d5852e49c3580960637d4cd4e11 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>

static int ferror_entry(void)
{
    int c;
    putc( 'c', stdin );
    if( ferror( stdin ) )
    {
        clearerr( stdin );
    }
    else
    {
        return -1;
    }
    return 0;
}

#include <utest.h>
static void test_ferror(void)
{
    uassert_int_equal(ferror_entry(), 0);
}
static void testcase(void)
{
    UTEST_UNIT_RUN(test_ferror);
}
UTEST_TC_EXPORT(testcase, "posix.stdio_h.ferror.c", RT_NULL, RT_NULL, 10);