lz32: Enable old test and expand it.

This commit is contained in:
Saulius Krasuckas 2006-06-16 22:43:15 +03:00 committed by Alexandre Julliard
parent 43fa835e0e
commit 183da10af4
1 changed files with 34 additions and 11 deletions

View File

@ -28,9 +28,7 @@
#include "wine/test.h" #include "wine/test.h"
static char filename_[] = "testfile.xx_"; static char filename_[] = "testfile.xx_";
#if 0
static char filename[] = "testfile.xxx"; static char filename[] = "testfile.xxx";
#endif
static char filename2[] = "testfile.yyy"; static char filename2[] = "testfile.yyy";
/* This is the hex string representation of the file created by compressing /* This is the hex string representation of the file created by compressing
@ -59,6 +57,9 @@ static void test_lzopenfile(void)
OFSTRUCT test; OFSTRUCT test;
DWORD retval; DWORD retval;
INT file; INT file;
char expected[MAX_PATH];
char filled_0xA5[OFS_MAXPATHNAME];
/* Check for nonexistent file. */ /* Check for nonexistent file. */
file = LZOpenFile("badfilename_", &test, OF_READ); file = LZOpenFile("badfilename_", &test, OF_READ);
@ -88,20 +89,42 @@ static void test_lzopenfile(void)
ok(file >= 0, "LZOpenFile failed on read/write\n"); ok(file >= 0, "LZOpenFile failed on read/write\n");
LZClose(file); LZClose(file);
/* If the file "foo.xxx" does not exist, LZOpenFile should then /* If the file "foo.xxx" does not exist, LZOpenFile should then
check for the file "foo.xx_" and open that -- at least on some check for the file "foo.xx_" and open that -- at least on some
operating systems. Doesn't seem to on my copy of Win98. operating systems. Doesn't seem to on my copy of Win98.
The Wine testing guidelines say we should accept the behavior of
any valid version of Windows. Thus it seems we cannot check this?!
Revisit this at some point to see if this can be tested somehow.
*/ */
#if 0 retval = GetCurrentDirectory(MAX_PATH, expected);
ok(retval > 0, "GetCurrentDirectory returned %ld, GLE=0x%lx\n",
retval, GetLastError());
lstrcatA(expected, "\\");
lstrcatA(expected, filename);
/* Compressed file name ends with underscore. */
retval = lstrlenA(expected);
expected[retval-1] = '_';
memset(&filled_0xA5, 0xA5, OFS_MAXPATHNAME);
memset(&test, 0xA5, sizeof(test));
SetLastError(0xfaceabee);
/* Try to open compressed file. */
file = LZOpenFile(filename, &test, OF_EXIST); file = LZOpenFile(filename, &test, OF_EXIST);
ok(file != LZERROR_BADINHANDLE, if(file != LZERROR_BADINHANDLE) { /* NT */
"LZOpenFile \"filename_\" check failed\n"); ok(test.cBytes == sizeof(OFSTRUCT),
LZClose(file); "LZOpenFile set test.cBytes to %d\n", test.cBytes);
#endif ok(test.nErrCode == 0,
"LZOpenFile set test.nErrCode to %d\n", test.nErrCode);
ok(lstrcmpA(test.szPathName, expected) == 0,
"LZOpenFile returned '%s', but was expected to return '%s'\n",
test.szPathName, expected);
LZClose(file);
} else { /* 9x */
ok(test.cBytes == 0xA5,
"LZOpenFile set test.cBytes to %d\n", test.cBytes);
ok(test.nErrCode == ERROR_FILE_NOT_FOUND,
"LZOpenFile set test.nErrCode to %d\n", test.nErrCode);
ok(strncmp(test.szPathName, filled_0xA5, OFS_MAXPATHNAME) == 0,
"LZOpenFile returned '%s', but was expected to return '%s'\n",
test.szPathName, filled_0xA5);
}
/* Delete the file then make sure it doesn't exist anymore. */ /* Delete the file then make sure it doesn't exist anymore. */
file = LZOpenFile(filename_, &test, OF_DELETE); file = LZOpenFile(filename_, &test, OF_DELETE);