The Win9x platforms support WideCharToMultiByte and

MultiByteToWideChar but not lstrcmpW! So I implemented our own so
that we can have a meaningful test.
This commit is contained in:
Francois Gouget 2002-12-12 02:16:29 +00:00 committed by Alexandre Julliard
parent 872f945044
commit 3773035a6d
1 changed files with 15 additions and 3 deletions

View File

@ -22,6 +22,16 @@
#include "winbase.h"
#include "winnls.h"
/* lstrcmpW is not supported on Win9x! */
static int mylstrcmpW(const WCHAR* str1, const WCHAR* str2)
{
while (*str1 && *str1==*str2) {
str1++;
str2++;
}
return *str1-*str2;
}
static void test_negative_source_length(void)
{
int len;
@ -31,14 +41,16 @@ static void test_negative_source_length(void)
/* Test, whether any negative source length works as strlen() + 1 */
SetLastError( 0xdeadbeef );
memset(buf,'x',sizeof(buf));
len = WideCharToMultiByte(CP_ACP, 0, foobarW, -2002, buf, 10, NULL, NULL);
ok(len == 7 && !lstrcmpA(buf, "foobar") && GetLastError() == 0xdeadbeef,
"any negative value should work as strlen() + 1");
"WideCharToMultiByte(-2002): len=%d error=%ld",len,GetLastError());
SetLastError( 0xdeadbeef );
memset(bufW,'x',sizeof(bufW));
len = MultiByteToWideChar(CP_ACP, 0, "foobar", -2002, bufW, 10);
ok(len == 7 && !lstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
"any negative value should work as strlen() + 1");
ok(len == 7 && !mylstrcmpW(bufW, foobarW) && GetLastError() == 0xdeadbeef,
"MultiByteToWideChar(-2002): len=%d error=%ld",len,GetLastError());
}
START_TEST(codepage)