X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=functions%2Fstdio%2Ffopen.c;h=fa0185f9f320b781c3dbff0565d3e08425eed0de;hb=d6f1494a4f38a212b29a13ee713885058dcf0fe7;hp=bc9fab4183b42f9b73f2136af778588ac5aa00d4;hpb=55cf35957bf8dec0a489ba758c02c83303a5eb50;p=pdclib diff --git a/functions/stdio/fopen.c b/functions/stdio/fopen.c index bc9fab4..fa0185f 100644 --- a/functions/stdio/fopen.c +++ b/functions/stdio/fopen.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /* fopen( const char *, const char * ) This file is part of the Public Domain C Library (PDCLib). @@ -10,7 +8,7 @@ #include #ifndef REGTEST -#include <_PDCLIB_glue.h> +#include "_PDCLIB_glue.h" #include extern struct _PDCLIB_file_t * _PDCLIB_filelist; @@ -75,7 +73,7 @@ struct _PDCLIB_file_t * fopen( const char * _PDCLIB_restrict filename, const cha #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" int main( void ) { @@ -83,16 +81,18 @@ int main( void ) my system is at once less forgiving (segfaults on mode NULL) and more forgiving (accepts undefined modes). */ - remove( "testing/testfile" ); + FILE * fh; + remove( testfile ); TESTCASE_NOREG( fopen( NULL, NULL ) == NULL ); TESTCASE( fopen( NULL, "w" ) == NULL ); TESTCASE_NOREG( fopen( "", NULL ) == NULL ); TESTCASE( fopen( "", "w" ) == NULL ); TESTCASE( fopen( "foo", "" ) == NULL ); - TESTCASE_NOREG( fopen( "testing/testfile", "wq" ) == NULL ); /* Undefined mode */ - TESTCASE_NOREG( fopen( "testing/testfile", "wr" ) == NULL ); /* Undefined mode */ - TESTCASE( fopen( "testing/testfile", "w" ) != NULL ); - remove( "testing/testfile" ); + TESTCASE_NOREG( fopen( testfile, "wq" ) == NULL ); /* Undefined mode */ + TESTCASE_NOREG( fopen( testfile, "wr" ) == NULL ); /* Undefined mode */ + TESTCASE( ( fh = fopen( testfile, "w" ) ) != NULL ); + TESTCASE( fclose( fh ) == 0 ); + TESTCASE( remove( testfile ) == 0 ); return TEST_RESULTS; }