Fix the kernel/codepage tests
Francois Gouget
fgouget at free.fr
Wed Dec 11 13:43:18 CST 2002
Changelog:
* dlls/kernel/tests/codepage.c
The Win9x platforms support WideCharToMultiByte and
MultiByteToWideChar but not lstrcmpW!
So I implemented our own so that we can have a meaningful test
Index: dlls/kernel/tests/codepage.c
===================================================================
RCS file: /home/wine/wine/dlls/kernel/tests/codepage.c,v
retrieving revision 1.1
diff -u -r1.1 codepage.c
--- dlls/kernel/tests/codepage.c 4 Oct 2002 17:42:27 -0000 1.1
+++ dlls/kernel/tests/codepage.c 11 Dec 2002 19:30:51 -0000
@@ -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 @@
/* 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)
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
Linux, WinNT, MS-DOS - also known as the Good, the Bad and the Ugly.
More information about the wine-patches
mailing list