diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index 925b74801da..07eb8dc8b9c 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -32,6 +32,7 @@ #include #include #include +#include "msvcrt.h" static void test_fdopen( void ) { @@ -132,53 +133,124 @@ static void test_fileops( void ) unlink ("fdopen.tst"); } -static void test_asciifileops( void ) +#define IOMODE (ao?"ascii mode":"binary mode") +static void test_readmode( BOOL ascii_mode ) { static const char outbuffer[] = "0,1,2,3,4,5,6,7,8,9\r\n\r\nA,B,C,D,E\r\nX,Y,Z"; - char buffer[256]; + static const char padbuffer[] = "ghjghjghjghj"; + static const char nlbuffer[] = "\r\n"; + char buffer[MSVCRT_BUFSIZ+256]; int fd; FILE *file; - int i; + int i, j, fp, ao, *ip, pl; long l; fd = open ("fdopen.tst", O_WRONLY | O_CREAT | O_BINARY, _S_IREAD |_S_IWRITE); + /* an internal buffer of MSVCRT_BUFSIZ is maintained, so make a file big + * enough to test operations that cross the buffer boundary + */ + j = (MSVCRT_BUFSIZ-4)/strlen(padbuffer); + for (i=0; i