From 780deecfd74127af87cbbf03b5a75d996c73b79a Mon Sep 17 00:00:00 2001 From: Robert Shearman Date: Tue, 17 Feb 2004 20:24:50 +0000 Subject: [PATCH] - Add IntlStrEqWorkerA/W. - StrCmp tests. --- dlls/shlwapi/shlwapi.spec | 4 ++-- dlls/shlwapi/string.c | 4 ++-- dlls/shlwapi/tests/string.c | 42 +++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 4 deletions(-) diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index adf2adc96f5..c67e8003d7d 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -561,8 +561,8 @@ @ stdcall DllGetVersion (ptr) SHLWAPI_DllGetVersion @ stdcall GetMenuPosFromID(ptr long) @ stdcall HashData (ptr long ptr long) -@ stub IntlStrEqWorkerA -@ stub IntlStrEqWorkerW +@ stdcall IntlStrEqWorkerA(long str str long) StrIsIntlEqualA +@ stdcall IntlStrEqWorkerW(long wstr wstr long) StrIsIntlEqualW @ stdcall PathAddBackslashA (str) @ stdcall PathAddBackslashW (wstr) @ stdcall PathAddExtensionA (str str) diff --git a/dlls/shlwapi/string.c b/dlls/shlwapi/string.c index 7b1a42ee8aa..a6bae527c57 100644 --- a/dlls/shlwapi/string.c +++ b/dlls/shlwapi/string.c @@ -671,13 +671,13 @@ LPWSTR WINAPI StrStrIW(LPCWSTR lpszStr, LPCWSTR lpszSearch) /************************************************************************* * StrToIntA [SHLWAPI.@] * - * Read an integer from a string. + * Read a signed integer from a string. * * PARAMS * lpszStr [I] String to read integer from * * RETURNS - * The integer value represented by the string, or 0 if no integer is + * The signed integer value represented by the string, or 0 if no integer is * present. * * NOTES diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c index d897cd4517a..07cdefc5e77 100644 --- a/dlls/shlwapi/tests/string.c +++ b/dlls/shlwapi/tests/string.c @@ -546,6 +546,46 @@ void test_StrFromTimeIntervalA(void) } } +void test_StrCmpA(void) +{ + static const char str1[] = {'a','b','c','d','e','f'}; + static const char str2[] = {'a','B','c','d','e','f'}; + ok(0 != StrCmpNA(str1, str2, 6), "StrCmpNA is case-insensitive\n"); + ok(0 == StrCmpNIA(str1, str2, 6), "StrCmpNIA is case-sensitive\n"); + ok(!ChrCmpIA('a', 'a'), "ChrCmpIA doesn't work at all!\n"); + ok(!ChrCmpIA('b', 'B'), "ChrCmpIA is not case-insensitive\n"); + ok(ChrCmpIA('a', 'z'), "ChrCmpIA believes that a == z!\n"); + + todo_wine + { + ok(StrIsIntlEqualA(FALSE, str1, str2, 5), "StrIsIntlEqualA(FALSE,...) isn't case-insensitive\n"); + } + ok(!StrIsIntlEqualA(TRUE, str1, str2, 5), "StrIsIntlEqualA(TRUE,...) isn't case-sensitive\n"); + + todo_wine + { + ok(IntlStrEqWorkerA(FALSE, str1, str2, 5), "IntlStrEqWorkerA(FALSE,...) isn't case-insensitive\n"); + } + ok(!IntlStrEqWorkerA(TRUE, str1, str2, 5), "IntlStrEqWorkerA(TRUE,...) isn't case-sensitive\n"); +} + +void test_StrCmpW(void) +{ + static const WCHAR str1[] = {'a','b','c','d','e','f'}; + static const WCHAR str2[] = {'a','B','c','d','e','f'}; + ok(0 != StrCmpNW(str1, str2, 5), "StrCmpNW is case-insensitive\n"); + ok(0 == StrCmpNIW(str1, str2, 5), "StrCmpNIW is case-sensitive\n"); + ok(!ChrCmpIW('a', 'a'), "ChrCmpIW doesn't work at all!\n"); + ok(!ChrCmpIW('b', 'B'), "ChrCmpIW is not case-insensitive\n"); + ok(ChrCmpIW('a', 'z'), "ChrCmpIW believes that a == z!\n"); + + ok(StrIsIntlEqualW(FALSE, str1, str2, 5), "StrIsIntlEqualW(FALSE,...) isn't case-insensitive\n"); + ok(!StrIsIntlEqualW(TRUE, str1, str2, 5), "StrIsIntlEqualW(TRUE,...) isn't case-sensitive\n"); + + ok(IntlStrEqWorkerW(FALSE, str1, str2, 5), "IntlStrEqWorkerW(FALSE,...) isn't case-insensitive\n"); + ok(!IntlStrEqWorkerW(TRUE, str1, str2, 5), "IntlStrEqWorkerW(TRUE,...) isn't case-sensitive\n"); +} + static WCHAR *CoDupStrW(const char* src) { INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0); @@ -611,5 +651,7 @@ START_TEST(string) test_StrFormatKBSizeA(); test_StrFormatKBSizeW(); test_StrFromTimeIntervalA(); + test_StrCmpA(); + test_StrCmpW(); test_StrRetToBSTR(); }