5 This file is part of the Public Domain C Library (PDCLib).
6 Permission is granted to use, modify, and / or redistribute at will.
13 void clearerr( struct _PDCLIB_file_t * stream )
15 stream->status &= ~( _PDCLIB_ERRORFLAG | _PDCLIB_EOFFLAG );
21 #include <_PDCLIB_test.h>
26 FILE file = { 0, { 0 }, NULL, 0, 0, 0, NULL };
28 TESTCASE( ! ferror( fh ) );
29 TESTCASE( ! feof( fh ) );
30 fh->status |= _PDCLIB_ERRORFLAG;
31 TESTCASE( ferror( fh ) );
32 TESTCASE( ! feof( fh ) );
34 TESTCASE( ! ferror( fh ) );
35 TESTCASE( ! feof( fh ) );
36 fh->status |= _PDCLIB_EOFFLAG;
37 TESTCASE( ! ferror( fh ) );
38 TESTCASE( feof( fh ) );
40 TESTCASE( ! ferror( fh ) );
41 TESTCASE( ! feof( fh ) );
42 fh->status |= _PDCLIB_EOFFLAG | _PDCLIB_ERRORFLAG;
43 TESTCASE( ferror( fh ) );
44 TESTCASE( feof( fh ) );
46 TESTCASE( ! ferror( fh ) );
47 TESTCASE( ! feof( fh ) );
49 /* TODO: The above is ad-hoc and PDCLib specific. A better test driver
50 should be internals-agnostic (provoking the error / eof flag by
51 "regular" operations).
53 TESTCASE( NO_TESTDRIVER );