msvcp90/tests: Added char_traits equal tests.

This commit is contained in:
Piotr Caban 2010-07-20 23:24:51 +02:00 committed by Alexandre Julliard
parent d589d95d50
commit b5a6ed7469
1 changed files with 44 additions and 0 deletions

View File

@ -28,6 +28,10 @@ static void (__cdecl *p_char_assign)(void*, const void*);
static void (__cdecl *p_wchar_assign)(void*, const void*); static void (__cdecl *p_wchar_assign)(void*, const void*);
static void (__cdecl *p_short_assign)(void*, const void*); static void (__cdecl *p_short_assign)(void*, const void*);
static BYTE (__cdecl *p_char_eq)(const void*, const void*);
static BYTE (__cdecl *p_wchar_eq)(const void*, const void*);
static BYTE (__cdecl *p_short_eq)(const void*, const void*);
static int invalid_parameter = 0; static int invalid_parameter = 0;
static void __cdecl test_invalid_parameter_handler(const wchar_t *expression, static void __cdecl test_invalid_parameter_handler(const wchar_t *expression,
const wchar_t *function, const wchar_t *file, const wchar_t *function, const wchar_t *file,
@ -62,6 +66,10 @@ static BOOL init(void)
p_wchar_assign = (void*)GetProcAddress(msvcp, "?assign@?$char_traits@_W@std@@SAXAA_WAB_W@Z"); p_wchar_assign = (void*)GetProcAddress(msvcp, "?assign@?$char_traits@_W@std@@SAXAA_WAB_W@Z");
p_short_assign = (void*)GetProcAddress(msvcp, "?assign@?$char_traits@G@std@@SAXAAGABG@Z"); p_short_assign = (void*)GetProcAddress(msvcp, "?assign@?$char_traits@G@std@@SAXAAGABG@Z");
p_char_eq = (void*)GetProcAddress(msvcp, "?eq@?$char_traits@D@std@@SA_NABD0@Z");
p_wchar_eq = (void*)GetProcAddress(msvcp, "?eq@?$char_traits@_W@std@@SA_NAB_W0@Z");
p_short_eq = (void*)GetProcAddress(msvcp, "?eq@?$char_traits@G@std@@SA_NABG0@Z");
return TRUE; return TRUE;
} }
@ -93,12 +101,48 @@ static void test_assign(void)
ok(out[2] == '#', "out[2] = %c\n", out[2]); ok(out[2] == '#', "out[2] = %c\n", out[2]);
} }
static void test_equal(void)
{
static const char in1[] = "abc";
static const char in2[] = "ab";
static const char in3[] = "a";
static const char in4[] = "b";
BYTE ret;
if(!p_char_eq || !p_wchar_eq || !p_short_eq) {
win_skip("equal tests skipped\n");
return;
}
ret = p_char_eq(in1, in2);
ok(ret == TRUE, "ret = %d\n", (int)ret);
ret = p_char_eq(in1, in3);
ok(ret == TRUE, "ret = %d\n", (int)ret);
ret = p_char_eq(in1, in4);
ok(ret == FALSE, "ret = %d\n", (int)ret);
ret = p_wchar_eq(in1, in2);
ok(ret == TRUE, "ret = %d\n", (int)ret);
ret = p_wchar_eq(in1, in3);
ok(ret == FALSE, "ret = %d\n", (int)ret);
ret = p_wchar_eq(in1, in4);
ok(ret == FALSE, "ret = %d\n", (int)ret);
ret = p_short_eq(in1, in2);
ok(ret == TRUE, "ret = %d\n", (int)ret);
ret = p_short_eq(in1, in3);
ok(ret == FALSE, "ret = %d\n", (int)ret);
ret = p_short_eq(in1, in4);
ok(ret == FALSE, "ret = %d\n", (int)ret);
}
START_TEST(misc) START_TEST(misc)
{ {
if(!init()) if(!init())
return; return;
test_assign(); test_assign();
test_equal();
ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n"); ok(!invalid_parameter, "invalid_parameter_handler was invoked too many times\n");
} }