Piotr Caban : msvcr90/tests: Make some tests fail if invalid_parameter_handler was not invoked.
Alexandre Julliard
julliard at winehq.org
Mon Oct 25 10:58:20 CDT 2010
Module: wine
Branch: master
Commit: 3b7a5d410e05ed20955abecaa2e628ea6a14d65b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3b7a5d410e05ed20955abecaa2e628ea6a14d65b
Author: Piotr Caban <piotr at codeweavers.com>
Date: Sun Oct 24 23:41:23 2010 +0200
msvcr90/tests: Make some tests fail if invalid_parameter_handler was not invoked.
---
dlls/msvcr90/tests/msvcr90.c | 44 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index ad0d334..5a60871 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -25,6 +25,32 @@
#include <errno.h>
#include "wine/test.h"
+#define DEFINE_EXPECT(func) \
+ static BOOL expect_ ## func = FALSE, called_ ## func = FALSE
+
+#define SET_EXPECT(func) \
+ expect_ ## func = TRUE
+
+#define CHECK_EXPECT2(func) \
+ do { \
+ ok(expect_ ##func, "unexpected call " #func "\n"); \
+ called_ ## func = TRUE; \
+ }while(0)
+
+#define CHECK_EXPECT(func) \
+ do { \
+ CHECK_EXPECT2(func); \
+ expect_ ## func = FALSE; \
+ }while(0)
+
+#define CHECK_CALLED(func) \
+ do { \
+ ok(called_ ## func, "expected " #func "\n"); \
+ expect_ ## func = called_ ## func = FALSE; \
+ }while(0)
+
+DEFINE_EXPECT(invalid_parameter_handler);
+
static _invalid_parameter_handler (__cdecl *p_set_invalid_parameter_handler)(_invalid_parameter_handler);
typedef int (__cdecl *_INITTERM_E_FN)(void);
static int (__cdecl *p_initterm_e)(_INITTERM_E_FN *table, _INITTERM_E_FN *end);
@@ -48,6 +74,7 @@ static void __cdecl test_invalid_parameter_handler(const wchar_t *expression,
const wchar_t *function, const wchar_t *file,
unsigned line, uintptr_t arg)
{
+ CHECK_EXPECT(invalid_parameter_handler);
ok(expression == NULL, "expression is not NULL\n");
ok(function == NULL, "function is not NULL\n");
ok(file == NULL, "file is not NULL\n");
@@ -223,18 +250,35 @@ static void test__strtoi64(void)
}
errno = 0xdeadbeef;
+ SET_EXPECT(invalid_parameter_handler);
res = p_strtoi64(NULL, NULL, 10);
ok(res == 0, "res != 0\n");
+ CHECK_CALLED(invalid_parameter_handler);
+
+ SET_EXPECT(invalid_parameter_handler);
res = p_strtoi64("123", NULL, 1);
ok(res == 0, "res != 0\n");
+ CHECK_CALLED(invalid_parameter_handler);
+
+ SET_EXPECT(invalid_parameter_handler);
res = p_strtoi64("123", NULL, 37);
ok(res == 0, "res != 0\n");
+ CHECK_CALLED(invalid_parameter_handler);
+
+ SET_EXPECT(invalid_parameter_handler);
ures = p_strtoui64(NULL, NULL, 10);
ok(ures == 0, "res = %d\n", (int)ures);
+ CHECK_CALLED(invalid_parameter_handler);
+
+ SET_EXPECT(invalid_parameter_handler);
ures = p_strtoui64("123", NULL, 1);
ok(ures == 0, "res = %d\n", (int)ures);
+ CHECK_CALLED(invalid_parameter_handler);
+
+ SET_EXPECT(invalid_parameter_handler);
ures = p_strtoui64("123", NULL, 37);
ok(ures == 0, "res = %d\n", (int)ures);
+ CHECK_CALLED(invalid_parameter_handler);
ok(errno == 0xdeadbeef, "errno = %x\n", errno);
}
More information about the wine-cvs
mailing list