summaryrefslogtreecommitdiff
path: root/examples/utest/testcases/posix/stdio_h/functions/perror_tc.c
blob: 6c2620fcc492bb26f7fea9e78b3ed8f7bbb14b3c (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
#include <stdio.h>

static int perror_entry(void)
{
    FILE *stream;
    stream = fopen( "nulltest.txt", "r" );
    if(stream == NULL)
    {
        printf("perror test:");
        perror("nulltest.txt");
        return -1;
    }
    fclose(stream);
    return 0;
}

#include <utest.h>
static void test_perror(void)
{
    uassert_int_equal(perror_entry(), 0);
}
static void testcase(void)
{
    UTEST_UNIT_RUN(test_perror);
}
UTEST_TC_EXPORT(testcase, "rtt_posix_testcase.stdio_h."__FILE__, RT_NULL, RT_NULL, 10);