Andrew Nguyen : setupapi: Exhaustively test the invalid parameter handling of SetupDecompressOrCopyFileA .
Alexandre Julliard
julliard at winehq.org
Wed Jun 16 13:23:22 CDT 2010
Module: wine
Branch: master
Commit: 53a563bb384548a5f93ffc34df11b26449d653a4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=53a563bb384548a5f93ffc34df11b26449d653a4
Author: Andrew Nguyen <anguyen at codeweavers.com>
Date: Tue Jun 15 05:21:19 2010 -0500
setupapi: Exhaustively test the invalid parameter handling of SetupDecompressOrCopyFileA.
---
dlls/setupapi/tests/misc.c | 44 +++++++++++++++++++++++++++++++++++---------
1 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c
index a3abde4..20f2683 100644
--- a/dlls/setupapi/tests/misc.c
+++ b/dlls/setupapi/tests/misc.c
@@ -506,6 +506,22 @@ static void test_SetupDecompressOrCopyFile(void)
DWORD ret;
char source[MAX_PATH], target[MAX_PATH], temp[MAX_PATH], *p;
UINT type;
+ int i;
+
+ const struct
+ {
+ PCSTR source;
+ PCSTR target;
+ PUINT type;
+ } invalid_parameters[] =
+ {
+ {NULL, NULL, NULL},
+ {NULL, NULL, &type},
+ {NULL, target, NULL},
+ {NULL, target, &type},
+ {source, NULL, NULL},
+ {source, NULL, &type},
+ };
GetTempPathA(sizeof(temp), temp);
GetTempFileNameA(temp, "doc", 0, source);
@@ -515,15 +531,25 @@ static void test_SetupDecompressOrCopyFile(void)
create_source_file(source, uncompressed, sizeof(uncompressed));
- ret = SetupDecompressOrCopyFileA(NULL, NULL, NULL);
- ok(ret == ERROR_INVALID_PARAMETER, "SetupDecompressOrCopyFile failed unexpectedly\n");
-
- type = FILE_COMPRESSION_NONE;
- ret = SetupDecompressOrCopyFileA(NULL, target, &type);
- ok(ret == ERROR_INVALID_PARAMETER, "SetupDecompressOrCopyFile failed unexpectedly\n");
-
- ret = SetupDecompressOrCopyFileA(source, NULL, &type);
- ok(ret == ERROR_INVALID_PARAMETER, "SetupDecompressOrCopyFile failed unexpectedly\n");
+ for (i = 0; i < sizeof(invalid_parameters)/sizeof(invalid_parameters[0]); i++)
+ {
+ type = FILE_COMPRESSION_NONE;
+ ret = SetupDecompressOrCopyFileA(invalid_parameters[i].source,
+ invalid_parameters[i].target,
+ invalid_parameters[i].type);
+ ok(ret == ERROR_INVALID_PARAMETER,
+ "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %u\n",
+ i, ret);
+
+ /* try an invalid compression type */
+ type = 5;
+ ret = SetupDecompressOrCopyFileA(invalid_parameters[i].source,
+ invalid_parameters[i].target,
+ invalid_parameters[i].type);
+ ok(ret == ERROR_INVALID_PARAMETER,
+ "[%d] Expected SetupDecompressOrCopyFileA to return ERROR_INVALID_PARAMETER, got %u\n",
+ i, ret);
+ }
type = 5; /* try an invalid compression type */
ret = SetupDecompressOrCopyFileA(source, target, &type);
More information about the wine-cvs
mailing list