mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
added a few more fsd tests
svn path=/trunk/; revision=1844
This commit is contained in:
parent
b76211b20a
commit
d73834ea4f
1 changed files with 73 additions and 25 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: testfsd.c,v 1.1 2001/05/01 04:35:08 rex Exp $
|
/* $Id: testfsd.c,v 1.2 2001/05/01 17:36:04 rex Exp $
|
||||||
*
|
*
|
||||||
* FILE: testFSD.c
|
* FILE: testFSD.c
|
||||||
* PURPOSE: A test set for the File System Driver
|
* PURPOSE: A test set for the File System Driver
|
||||||
|
@ -13,6 +13,15 @@
|
||||||
|
|
||||||
#define ASSERT(x) doAssertion (x, #x, __FUNCTION__, __LINE__)
|
#define ASSERT(x) doAssertion (x, #x, __FUNCTION__, __LINE__)
|
||||||
|
|
||||||
|
struct TestSuite
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
(void)(*testFunc)(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ADD_TEST(x) {#x, x}
|
||||||
|
#define COUNT_TESTS(x) (sizeof x/sizeof (struct TestSuite))
|
||||||
|
|
||||||
const char *rootDir = "c:\\";
|
const char *rootDir = "c:\\";
|
||||||
const char *systemRootDir = "c:\\ReactOS";
|
const char *systemRootDir = "c:\\ReactOS";
|
||||||
const char *systemDllDir = "c:\\ReactOS\\System32";
|
const char *systemDllDir = "c:\\ReactOS\\System32";
|
||||||
|
@ -31,21 +40,28 @@ void testCreateExistant (void);
|
||||||
void testCreateNonExistant (void);
|
void testCreateNonExistant (void);
|
||||||
void testOverwriteExistant (void);
|
void testOverwriteExistant (void);
|
||||||
void testOverwriteNonExistant (void);
|
void testOverwriteNonExistant (void);
|
||||||
|
void testOpenWithBlankPathElements (void);
|
||||||
|
|
||||||
void testOpenWithBlankPathName (void);
|
struct TestSuite gTests [] =
|
||||||
void testOpenWithBlankDirElement (void);
|
{
|
||||||
|
ADD_TEST (testOpenExistant),
|
||||||
|
ADD_TEST (testOpenNonExistant),
|
||||||
|
ADD_TEST (testCreateExistant),
|
||||||
|
ADD_TEST (testCreateNonExistant),
|
||||||
|
ADD_TEST (testOverwriteExistant),
|
||||||
|
ADD_TEST (testOverwriteNonExistant),
|
||||||
|
ADD_TEST (testOpenWithBlankPathElements)
|
||||||
|
};
|
||||||
|
|
||||||
int main (void)
|
int main (void)
|
||||||
{
|
{
|
||||||
tests = assertions = failures = successes = 0;
|
tests = assertions = failures = successes = 0;
|
||||||
|
|
||||||
testOpenExistant ();
|
for (testIndex = 0; testIndex < COUNT_TESTS(gTests); testIndex++)
|
||||||
testOpenNonExistant ();
|
{
|
||||||
testCreateExistant ();
|
gTests [testIndex].testFunc ();
|
||||||
testCreateNonExistant ();
|
tests++;
|
||||||
testOpenWithBlankPathName ();
|
}
|
||||||
testOpenWithBlankDirElement ();
|
|
||||||
// testFullObjectPaths ();
|
|
||||||
|
|
||||||
printf ("\nTotals: tests: %d assertions: %d successes: %d failures: %d\n",
|
printf ("\nTotals: tests: %d assertions: %d successes: %d failures: %d\n",
|
||||||
tests,
|
tests,
|
||||||
|
@ -66,8 +82,6 @@ void testOpenExistant (void)
|
||||||
{
|
{
|
||||||
HANDLE fileHandle;
|
HANDLE fileHandle;
|
||||||
|
|
||||||
tests++;
|
|
||||||
|
|
||||||
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||||
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
CloseHandle (fileHandle);
|
CloseHandle (fileHandle);
|
||||||
|
@ -86,8 +100,6 @@ void testOpenNonExistant (void)
|
||||||
DWORD status;
|
DWORD status;
|
||||||
HANDLE fileHandle;
|
HANDLE fileHandle;
|
||||||
|
|
||||||
tests++;
|
|
||||||
|
|
||||||
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
||||||
OPEN_EXISTING, 0, 0);
|
OPEN_EXISTING, 0, 0);
|
||||||
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||||
|
@ -119,8 +131,6 @@ void testCreateExistant (void)
|
||||||
DWORD status;
|
DWORD status;
|
||||||
HANDLE fileHandle;
|
HANDLE fileHandle;
|
||||||
|
|
||||||
tests++;
|
|
||||||
|
|
||||||
printf ("before CreateFile (%s)\n", rootDir);
|
printf ("before CreateFile (%s)\n", rootDir);
|
||||||
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0,
|
fileHandle = CreateFile (rootDir, GENERIC_READ, 0, 0,
|
||||||
CREATE_NEW, 0, 0);
|
CREATE_NEW, 0, 0);
|
||||||
|
@ -146,20 +156,58 @@ printf ("after CreateFile (%s)\n", rootDir);
|
||||||
|
|
||||||
void testCreateNonExistant (void)
|
void testCreateNonExistant (void)
|
||||||
{
|
{
|
||||||
tests++;
|
DWORD status;
|
||||||
|
HANDLE fileHandle;
|
||||||
|
|
||||||
|
fileHandle = CreateFile (bogusRootFile, GENERIC_READ, 0, 0,
|
||||||
|
CREATE_NEW, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile (bogusSystemRootFile, GENERIC_READ, 0, 0,
|
||||||
|
CREATE_NEW, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile (bogusSystemDllFile, GENERIC_READ, 0, 0,
|
||||||
|
CREATE_NEW, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
fileHandle = CreateFile (bogusDirAndFile, GENERIC_READ, 0, 0,
|
||||||
|
CREATE_NEW, 0, 0);
|
||||||
|
ASSERT (fileHandle == INVALID_HANDLE_VALUE);
|
||||||
|
status = GetLastError ();
|
||||||
|
ASSERT (status == ERROR_PATH_NOT_FOUND);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void testOpenWithBlankPathName (void)
|
void testOpenWithBlankPathElements (void)
|
||||||
{
|
{
|
||||||
tests++;
|
HANDLE fileHandle;
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void testOpenWithBlankDirElement (void)
|
|
||||||
{
|
|
||||||
tests++;
|
|
||||||
|
|
||||||
|
fileHandle = CreateFile ("c:", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile ("c:\\\\", GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile ("c:\\\\reactos\\", GENERIC_READ, 0, 0,
|
||||||
|
OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile ("c:\\reactos\\\\", GENERIC_READ, 0, 0,
|
||||||
|
OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile ("c:\\reactos\\\\system32\\", GENERIC_READ, 0, 0,
|
||||||
|
OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
|
fileHandle = CreateFile ("c:\\reactos\\system32\\\\", GENERIC_READ, 0, 0,
|
||||||
|
OPEN_EXISTING, 0, 0);
|
||||||
|
ASSERT (fileHandle != INVALID_HANDLE_VALUE);
|
||||||
|
CloseHandle (fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void doAssertion (BOOL pTest, PCHAR pTestText, PCHAR pFunction, int pLine)
|
void doAssertion (BOOL pTest, PCHAR pTestText, PCHAR pFunction, int pLine)
|
||||||
|
|
Loading…
Reference in a new issue