1 /* Unit test suite for SHLWAPI string functions
3 * Copyright 2003 Jon Griffiths
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define NONAMELESSUNION
23 #define NONAMELESSSTRUCT
24 #include "wine/test.h"
28 #define NO_SHLWAPI_REG
29 #define NO_SHLWAPI_PATH
30 #define NO_SHLWAPI_GDI
31 #define NO_SHLWAPI_STREAM
35 static HMODULE hShlwapi
;
36 static LPSTR (WINAPI
*pStrCpyNXA
)(LPSTR
,LPCSTR
,int);
37 static LPWSTR (WINAPI
*pStrCpyNXW
)(LPWSTR
,LPCWSTR
,int);
38 static HRESULT (WINAPI
*pStrRetToBSTR
)(STRRET
*,void*,BSTR
*);
39 static DWORD (WINAPI
*pSHAnsiToAnsi
)(LPCSTR
,LPSTR
,int);
40 static DWORD (WINAPI
*pSHUnicodeToUnicode
)(LPCWSTR
,LPWSTR
,int);
41 static BOOL (WINAPI
*pStrIsIntlEqualA
)(BOOL
,LPCSTR
,LPCSTR
,int);
42 static BOOL (WINAPI
*pIntlStrEqWorkerA
)(BOOL
,LPCSTR
,LPCSTR
,int);
43 static BOOL (WINAPI
*pStrIsIntlEqualW
)(BOOL
,LPCWSTR
,LPCWSTR
,int);
44 static BOOL (WINAPI
*pIntlStrEqWorkerW
)(BOOL
,LPCWSTR
,LPCWSTR
,int);
46 static inline int strcmpW(const WCHAR
*str1
, const WCHAR
*str2
)
48 while (*str1
&& (*str1
== *str2
)) { str1
++; str2
++; }
52 /* StrToInt/StrToIntEx results */
53 typedef struct tagStrToIntResult
61 static const StrToIntResult StrToInt_results
[] = {
62 { "1099", 1099, 1099, 1099 },
63 { "+88987", 0, 88987, 88987 },
64 { "012", 12, 12, 12 },
65 { "-55", -55, -55, -55 },
67 { "0x44ff", 0, 0, 0x44ff },
68 { "+0x44f4", 0, 0, 0x44f4 },
69 { "-0x44fd", 0, 0, 0x44fd },
70 { "+ 88987", 0, 0, 0 },
73 { "+ 0x44f4", 0, 0, 0 },
74 { "--0x44fd", 0, 0, 0 },
75 { " 1999", 0, 1999, 1999 },
76 { " +88987", 0, 88987, 88987 },
77 { " 012", 0, 12, 12 },
78 { " -55", 0, -55, -55 },
79 { " 0x44ff", 0, 0, 0x44ff },
80 { " +0x44f4", 0, 0, 0x44f4 },
81 { " -0x44fd", 0, 0, 0x44fd },
85 /* pStrFormatByteSize64/StrFormatKBSize results */
86 typedef struct tagStrFormatSizeResult
89 const char* byte_size_64
;
91 } StrFormatSizeResult
;
94 static const StrFormatSizeResult StrFormatSize_results
[] = {
95 { -1023, "-1023 bytes", "0 KB"},
96 { -24, "-24 bytes", "0 KB"},
97 { 309, "309 bytes", "1 KB"},
98 { 10191, "9.95 KB", "10 KB"},
99 { 100353, "98.0 KB", "99 KB"},
100 { 1022286, "998 KB", "999 KB"},
101 { 1046862, "0.99 MB", "1,023 KB"},
102 { 1048574619, "999 MB", "1,023,999 KB"},
103 { 1073741775, "0.99 GB", "1,048,576 KB"},
104 { ((LONGLONG
)0x000000f9 << 32) | 0xfffff94e, "999 GB", "1,048,575,999 KB"},
105 { ((LONGLONG
)0x000000ff << 32) | 0xfffffa9b, "0.99 TB", "1,073,741,823 KB"},
106 { ((LONGLONG
)0x0003e7ff << 32) | 0xfffffa9b, "999 TB", "1,073,741,823,999 KB"},
107 { ((LONGLONG
)0x0003ffff << 32) | 0xfffffbe8, "0.99 PB", "1,099,511,627,775 KB"},
108 { ((LONGLONG
)0x0f9fffff << 32) | 0xfffffd35, "999 PB", "1,099,511,627,776,000 KB"},
109 { ((LONGLONG
)0x0fffffff << 32) | 0xfffffa9b, "0.99 EB", "1,125,899,906,842,623 KB"},
113 /* StrFormatByteSize64/StrFormatKBSize results */
114 typedef struct tagStrFromTimeIntervalResult
118 const char* time_interval
;
119 } StrFromTimeIntervalResult
;
122 static const StrFromTimeIntervalResult StrFromTimeInterval_results
[] = {
131 { 1000000, 1, " 10 min" },
132 { 1000000, 2, " 16 min" },
133 { 1000000, 3, " 16 min 40 sec" },
134 { 1000000, 4, " 16 min 40 sec" },
135 { 1000000, 5, " 16 min 40 sec" },
136 { 1000000, 6, " 16 min 40 sec" },
137 { 1000000, 7, " 16 min 40 sec" },
139 { 1999999, 1, " 30 min" },
140 { 1999999, 2, " 33 min" },
141 { 1999999, 3, " 33 min 20 sec" },
142 { 1999999, 4, " 33 min 20 sec" },
143 { 1999999, 5, " 33 min 20 sec" },
144 { 1999999, 6, " 33 min 20 sec" },
145 { 1999999, 7, " 33 min 20 sec" },
147 { 3999997, 1, " 1 hr" },
148 { 3999997, 2, " 1 hr 6 min" },
149 { 3999997, 3, " 1 hr 6 min 40 sec" },
150 { 3999997, 4, " 1 hr 6 min 40 sec" },
151 { 3999997, 5, " 1 hr 6 min 40 sec" },
152 { 3999997, 6, " 1 hr 6 min 40 sec" },
153 { 3999997, 7, " 1 hr 6 min 40 sec" },
155 { 149999851, 7, " 41 hr 40 min 0 sec" },
156 { 150999850, 1, " 40 hr" },
157 { 150999850, 2, " 41 hr" },
158 { 150999850, 3, " 41 hr 50 min" },
159 { 150999850, 4, " 41 hr 56 min" },
160 { 150999850, 5, " 41 hr 56 min 40 sec" },
161 { 150999850, 6, " 41 hr 56 min 40 sec" },
162 { 150999850, 7, " 41 hr 56 min 40 sec" },
164 { 493999507, 1, " 100 hr" },
165 { 493999507, 2, " 130 hr" },
166 { 493999507, 3, " 137 hr" },
167 { 493999507, 4, " 137 hr 10 min" },
168 { 493999507, 5, " 137 hr 13 min" },
169 { 493999507, 6, " 137 hr 13 min 20 sec" },
170 { 493999507, 7, " 137 hr 13 min 20 sec" },
175 static void test_StrChrA(void)
180 /* this test crashes on win2k SP4 */
181 /*ok(!StrChrA(NULL,'\0'), "found a character in a NULL string!\n");*/
183 for (count
= 32; count
< 128; count
++)
184 string
[count
] = (char)count
;
187 for (count
= 32; count
< 128; count
++)
189 LPSTR result
= StrChrA(string
+32, count
);
190 ok(result
- string
== count
,
191 "found char '%c' in wrong place: got %d, expected %d\n",
192 count
, result
- string
, count
);
195 for (count
= 32; count
< 128; count
++)
197 LPSTR result
= StrChrA(string
+count
+1, count
);
198 ok(!result
, "found char '%c' not in the string\n", count
);
202 static void test_StrChrW(void)
207 /* this test crashes on win2k SP4 */
208 /*ok(!StrChrW(NULL,'\0'), "found a character in a NULL string!\n");*/
210 for (count
= 32; count
< 16384; count
++)
211 string
[count
] = count
;
212 string
[16384] = '\0';
214 for (count
= 32; count
< 16384; count
++)
216 LPWSTR result
= StrChrW(string
+32, count
);
217 ok((result
- string
) == count
, "found char %d in wrong place\n", count
);
220 for (count
= 32; count
< 16384; count
++)
222 LPWSTR result
= StrChrW(string
+count
+1, count
);
223 ok(!result
, "found char not in the string\n");
227 static void test_StrChrIA(void)
232 /* this test crashes on win2k SP4 */
233 /*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!\n");*/
235 for (count
= 32; count
< 128; count
++)
236 string
[count
] = (char)count
;
239 for (count
= 'A'; count
<= 'X'; count
++)
241 LPSTR result
= StrChrIA(string
+32, count
);
243 ok(result
- string
== count
, "found char '%c' in wrong place\n", count
);
244 ok(StrChrIA(result
, count
)!=NULL
, "didn't find lowercase '%c'\n", count
);
247 for (count
= 'a'; count
< 'z'; count
++)
249 LPSTR result
= StrChrIA(string
+count
+1, count
);
250 ok(!result
, "found char not in the string\n");
254 static void test_StrChrIW(void)
259 /* this test crashes on win2k SP4 */
260 /*ok(!StrChrIA(NULL,'\0'), "found a character in a NULL string!\n");*/
262 for (count
= 32; count
< 128; count
++)
263 string
[count
] = count
;
266 for (count
= 'A'; count
<= 'X'; count
++)
268 LPWSTR result
= StrChrIW(string
+32, count
);
270 ok(result
- string
== count
, "found char '%c' in wrong place\n", count
);
271 ok(StrChrIW(result
, count
)!=NULL
, "didn't find lowercase '%c'\n", count
);
274 for (count
= 'a'; count
< 'z'; count
++)
276 LPWSTR result
= StrChrIW(string
+count
+1, count
);
277 ok(!result
, "found char not in the string\n");
281 static void test_StrRChrA(void)
286 /* this test crashes on win2k SP4 */
287 /*ok(!StrRChrA(NULL, NULL,'\0'), "found a character in a NULL string!\n");*/
289 for (count
= 32; count
< 128; count
++)
290 string
[count
] = (char)count
;
293 for (count
= 32; count
< 128; count
++)
295 LPSTR result
= StrRChrA(string
+32, NULL
, count
);
296 ok(result
- string
== count
, "found char %d in wrong place\n", count
);
299 for (count
= 32; count
< 128; count
++)
301 LPSTR result
= StrRChrA(string
+count
+1, NULL
, count
);
302 ok(!result
, "found char not in the string\n");
305 for (count
= 32; count
< 128; count
++)
307 LPSTR result
= StrRChrA(string
+count
+1, string
+ 127, count
);
308 ok(!result
, "found char not in the string\n");
312 static void test_StrRChrW(void)
317 /* this test crashes on win2k SP4 */
318 /*ok(!StrRChrW(NULL, NULL,'\0'), "found a character in a NULL string!\n");*/
320 for (count
= 32; count
< 128; count
++)
321 string
[count
] = count
;
324 for (count
= 32; count
< 128; count
++)
326 LPWSTR result
= StrRChrW(string
+32, NULL
, count
);
327 ok(result
- string
== count
,
328 "found char %d in wrong place: got %d, expected %d\n",
329 count
, result
- string
, count
);
332 for (count
= 32; count
< 128; count
++)
334 LPWSTR result
= StrRChrW(string
+count
+1, NULL
, count
);
335 ok(!result
, "found char %d not in the string\n", count
);
338 for (count
= 32; count
< 128; count
++)
340 LPWSTR result
= StrRChrW(string
+count
+1, string
+ 127, count
);
341 ok(!result
, "found char %d not in the string\n", count
);
345 static void test_StrCpyW(void)
349 const StrFormatSizeResult
* result
= StrFormatSize_results
;
354 MultiByteToWideChar(0,0,result
->byte_size_64
,-1,szSrc
,sizeof(szSrc
)/sizeof(WCHAR
));
356 StrCpyW(szBuff
, szSrc
);
357 ok(!StrCmpW(szSrc
, szBuff
), "Copied string %s wrong\n", result
->byte_size_64
);
363 static void test_StrToIntA(void)
365 const StrToIntResult
*result
= StrToInt_results
;
368 while (result
->string
)
370 return_val
= StrToIntA(result
->string
);
371 ok(return_val
== result
->str_to_int
, "converted '%s' wrong (%d)\n",
372 result
->string
, return_val
);
377 static void test_StrToIntW(void)
380 const StrToIntResult
*result
= StrToInt_results
;
383 while (result
->string
)
385 MultiByteToWideChar(0,0,result
->string
,-1,szBuff
,sizeof(szBuff
)/sizeof(WCHAR
));
386 return_val
= StrToIntW(szBuff
);
387 ok(return_val
== result
->str_to_int
, "converted '%s' wrong (%d)\n",
388 result
->string
, return_val
);
393 static void test_StrToIntExA(void)
395 const StrToIntResult
*result
= StrToInt_results
;
399 while (result
->string
)
402 bRet
= StrToIntExA(result
->string
,0,&return_val
);
403 ok(!bRet
|| return_val
!= -1, "No result returned from '%s'\n",
406 ok(return_val
== result
->str_to_int_ex
, "converted '%s' wrong (%d)\n",
407 result
->string
, return_val
);
411 result
= StrToInt_results
;
412 while (result
->string
)
415 bRet
= StrToIntExA(result
->string
,STIF_SUPPORT_HEX
,&return_val
);
416 ok(!bRet
|| return_val
!= -1, "No result returned from '%s'\n",
419 ok(return_val
== result
->str_to_int_hex
, "converted '%s' wrong (%d)\n",
420 result
->string
, return_val
);
425 static void test_StrToIntExW(void)
428 const StrToIntResult
*result
= StrToInt_results
;
432 while (result
->string
)
435 MultiByteToWideChar(0,0,result
->string
,-1,szBuff
,sizeof(szBuff
)/sizeof(WCHAR
));
436 bRet
= StrToIntExW(szBuff
, 0, &return_val
);
437 ok(!bRet
|| return_val
!= -1, "No result returned from '%s'\n",
440 ok(return_val
== result
->str_to_int_ex
, "converted '%s' wrong (%d)\n",
441 result
->string
, return_val
);
445 result
= StrToInt_results
;
446 while (result
->string
)
449 MultiByteToWideChar(0,0,result
->string
,-1,szBuff
,sizeof(szBuff
)/sizeof(WCHAR
));
450 bRet
= StrToIntExW(szBuff
, STIF_SUPPORT_HEX
, &return_val
);
451 ok(!bRet
|| return_val
!= -1, "No result returned from '%s'\n",
454 ok(return_val
== result
->str_to_int_hex
, "converted '%s' wrong (%d)\n",
455 result
->string
, return_val
);
460 static void test_StrDupA(void)
463 const StrFormatSizeResult
* result
= StrFormatSize_results
;
467 lpszStr
= StrDupA(result
->byte_size_64
);
469 ok(lpszStr
!= NULL
, "Dup failed\n");
472 ok(!strcmp(result
->byte_size_64
, lpszStr
), "Copied string wrong\n");
473 LocalFree((HLOCAL
)lpszStr
);
478 /* Later versions of shlwapi return NULL for this, but earlier versions
479 * returned an empty string (as Wine does).
481 lpszStr
= StrDupA(NULL
);
482 ok(lpszStr
== NULL
|| *lpszStr
== '\0', "NULL string returned %p\n", lpszStr
);
485 static void test_StrFormatByteSize64A(void)
488 const StrFormatSizeResult
* result
= StrFormatSize_results
;
492 StrFormatByteSize64A(result
->value
, szBuff
, 256);
494 ok(!strcmp(result
->byte_size_64
, szBuff
),
495 "Formatted %lx%08lx wrong: got %s, expected %s\n",
496 (LONG
)(result
->value
>> 32), (LONG
)result
->value
, szBuff
, result
->byte_size_64
);
502 static void test_StrFormatKBSizeW(void)
506 const StrFormatSizeResult
* result
= StrFormatSize_results
;
510 StrFormatKBSizeW(result
->value
, szBuffW
, 256);
511 WideCharToMultiByte(0,0,szBuffW
,-1,szBuff
,sizeof(szBuff
)/sizeof(WCHAR
),0,0);
512 ok(!strcmp(result
->kb_size
, szBuff
),
513 "Formatted %lx%08lx wrong: got %s, expected %s\n",
514 (LONG
)(result
->value
>> 32), (LONG
)result
->value
, szBuff
, result
->kb_size
);
519 static void test_StrFormatKBSizeA(void)
522 const StrFormatSizeResult
* result
= StrFormatSize_results
;
526 StrFormatKBSizeA(result
->value
, szBuff
, 256);
528 ok(!strcmp(result
->kb_size
, szBuff
),
529 "Formatted %lx%08lx wrong: got %s, expected %s\n",
530 (LONG
)(result
->value
>> 32), (LONG
)result
->value
, szBuff
, result
->kb_size
);
535 static void test_StrFromTimeIntervalA(void)
538 const StrFromTimeIntervalResult
* result
= StrFromTimeInterval_results
;
542 StrFromTimeIntervalA(szBuff
, 256, result
->ms
, result
->digits
);
544 ok(!strcmp(result
->time_interval
, szBuff
), "Formatted %ld %d wrong\n",
545 result
->ms
, result
->digits
);
550 static void test_StrCmpA(void)
552 static const char str1
[] = {'a','b','c','d','e','f'};
553 static const char str2
[] = {'a','B','c','d','e','f'};
554 ok(0 != StrCmpNA(str1
, str2
, 6), "StrCmpNA is case-insensitive\n");
555 ok(0 == StrCmpNIA(str1
, str2
, 6), "StrCmpNIA is case-sensitive\n");
556 ok(!ChrCmpIA('a', 'a'), "ChrCmpIA doesn't work at all!\n");
557 ok(!ChrCmpIA('b', 'B'), "ChrCmpIA is not case-insensitive\n");
558 ok(ChrCmpIA('a', 'z'), "ChrCmpIA believes that a == z!\n");
560 pStrIsIntlEqualA
= (void *)GetProcAddress(hShlwapi
, "StrIsIntlEqualA");
561 pIntlStrEqWorkerA
= (void *)GetProcAddress(hShlwapi
, "IntlStrEqWorkerA");
563 if (!pStrIsIntlEqualA
)
566 ok(pStrIsIntlEqualA(FALSE
, str1
, str2
, 5), "StrIsIntlEqualA(FALSE,...) isn't case-insensitive\n");
567 ok(!pStrIsIntlEqualA(TRUE
, str1
, str2
, 5), "StrIsIntlEqualA(TRUE,...) isn't case-sensitive\n");
569 if (!pIntlStrEqWorkerA
)
572 ok(pIntlStrEqWorkerA(FALSE
, str1
, str2
, 5), "IntlStrEqWorkerA(FALSE,...) isn't case-insensitive\n");
573 ok(!pIntlStrEqWorkerA(TRUE
, str1
, str2
, 5), "pIntlStrEqWorkerA(TRUE,...) isn't case-sensitive\n");
576 static void test_StrCmpW(void)
578 static const WCHAR str1
[] = {'a','b','c','d','e','f'};
579 static const WCHAR str2
[] = {'a','B','c','d','e','f'};
580 ok(0 != StrCmpNW(str1
, str2
, 5), "StrCmpNW is case-insensitive\n");
581 ok(0 == StrCmpNIW(str1
, str2
, 5), "StrCmpNIW is case-sensitive\n");
582 ok(!ChrCmpIW('a', 'a'), "ChrCmpIW doesn't work at all!\n");
583 ok(!ChrCmpIW('b', 'B'), "ChrCmpIW is not case-insensitive\n");
584 ok(ChrCmpIW('a', 'z'), "ChrCmpIW believes that a == z!\n");
586 pStrIsIntlEqualW
= (void *)GetProcAddress(hShlwapi
, "StrIsIntlEqualW");
587 pIntlStrEqWorkerW
= (void *)GetProcAddress(hShlwapi
, "IntlStrEqWorkerW");
589 if (!pStrIsIntlEqualW
)
592 ok(pStrIsIntlEqualW(FALSE
, str1
, str2
, 5), "StrIsIntlEqualW(FALSE,...) isn't case-insensitive\n");
593 ok(!pStrIsIntlEqualW(TRUE
, str1
, str2
, 5), "StrIsIntlEqualW(TRUE,...) isn't case-sensitive\n");
595 if (!pIntlStrEqWorkerW
)
598 ok(pIntlStrEqWorkerW(FALSE
, str1
, str2
, 5), "IntlStrEqWorkerW(FALSE,...) isn't case-insensitive\n");
599 ok(!pIntlStrEqWorkerW(TRUE
, str1
, str2
, 5), "IntlStrEqWorkerW(TRUE,...) isn't case-sensitive\n");
602 static WCHAR
*CoDupStrW(const char* src
)
604 INT len
= MultiByteToWideChar(CP_ACP
, 0, src
, -1, NULL
, 0);
605 WCHAR
* szTemp
= (WCHAR
*)CoTaskMemAlloc(len
* sizeof(WCHAR
));
606 MultiByteToWideChar(CP_ACP
, 0, src
, -1, szTemp
, len
);
610 static void test_StrRetToBSTR(void)
612 static const WCHAR szTestW
[] = { 'T','e','s','t','\0' };
618 pStrRetToBSTR
= (void *)GetProcAddress(hShlwapi
, "StrRetToBSTR");
619 if (!pStrRetToBSTR
) return;
621 strret
.uType
= STRRET_WSTR
;
622 strret
.u
.pOleStr
= CoDupStrW("Test");
624 ret
= pStrRetToBSTR(&strret
, NULL
, &bstr
);
625 ok(ret
== S_OK
&& bstr
&& !strcmpW(bstr
, szTestW
),
626 "STRRET_WSTR: dup failed, ret=0x%08lx, bstr %p\n", ret
, bstr
);
630 strret
.uType
= STRRET_CSTR
;
631 lstrcpyA(strret
.u
.cStr
, "Test");
632 ret
= pStrRetToBSTR(&strret
, NULL
, &bstr
);
633 ok(ret
== S_OK
&& bstr
&& !strcmpW(bstr
, szTestW
),
634 "STRRET_CSTR: dup failed, ret=0x%08lx, bstr %p\n", ret
, bstr
);
638 strret
.uType
= STRRET_OFFSET
;
639 strret
.u
.uOffset
= 1;
640 strcpy((char*)&iidl
, " Test");
641 ret
= pStrRetToBSTR(&strret
, iidl
, &bstr
);
642 ok(ret
== S_OK
&& bstr
&& !strcmpW(bstr
, szTestW
),
643 "STRRET_OFFSET: dup failed, ret=0x%08lx, bstr %p\n", ret
, bstr
);
647 /* Native crashes if str is NULL */
650 static void test_StrCpyNXA(void)
652 LPCSTR lpSrc
= "hello";
656 pStrCpyNXA
= (void *)GetProcAddress(hShlwapi
, (LPSTR
)399);
660 memset(dest
, '\n', sizeof(dest
));
661 lpszRes
= pStrCpyNXA(dest
, lpSrc
, sizeof(dest
)/sizeof(dest
[0]));
662 ok(lpszRes
== dest
+ 5 && !memcmp(dest
, "hello\0\n\n", sizeof(dest
)),
663 "StrCpyNXA: expected %p, \"hello\\0\\n\\n\", got %p, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
664 dest
+ 5, lpszRes
, dest
[0], dest
[1], dest
[2], dest
[3], dest
[4], dest
[5], dest
[6], dest
[7]);
667 static void test_StrCpyNXW(void)
669 static const WCHAR lpInit
[] = { '\n','\n','\n','\n','\n','\n','\n','\n' };
670 static const WCHAR lpSrc
[] = { 'h','e','l','l','o','\0' };
671 static const WCHAR lpRes
[] = { 'h','e','l','l','o','\0','\n','\n' };
675 pStrCpyNXW
= (void *)GetProcAddress(hShlwapi
, (LPSTR
)400);
679 memcpy(dest
, lpInit
, sizeof(lpInit
));
680 lpszRes
= pStrCpyNXW(dest
, lpSrc
, sizeof(dest
)/sizeof(dest
[0]));
681 ok(lpszRes
== dest
+ 5 && !memcmp(dest
, lpRes
, sizeof(dest
)),
682 "StrCpyNXA: expected %p, \"hello\\0\\n\\n\", got %p, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
683 dest
+ 5, lpszRes
, dest
[0], dest
[1], dest
[2], dest
[3], dest
[4], dest
[5], dest
[6], dest
[7]);
686 static void test_SHAnsiToAnsi(void)
691 pSHAnsiToAnsi
= (void *)GetProcAddress(hShlwapi
, (LPSTR
)345);
695 memset(dest
, '\n', sizeof(dest
));
696 dwRet
= pSHAnsiToAnsi("hello", dest
, sizeof(dest
)/sizeof(dest
[0]));
697 ok(dwRet
== 6 && !memcmp(dest
, "hello\0\n\n", sizeof(dest
)),
698 "SHAnsiToAnsi: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
699 dwRet
, dest
[0], dest
[1], dest
[2], dest
[3], dest
[4], dest
[5], dest
[6], dest
[7]);
702 static void test_SHUnicodeToUnicode(void)
704 static const WCHAR lpInit
[] = { '\n','\n','\n','\n','\n','\n','\n','\n' };
705 static const WCHAR lpSrc
[] = { 'h','e','l','l','o','\0' };
706 static const WCHAR lpRes
[] = { 'h','e','l','l','o','\0','\n','\n' };
710 pSHUnicodeToUnicode
= (void *)GetProcAddress(hShlwapi
, (LPSTR
)346);
711 if (!pSHUnicodeToUnicode
)
714 memcpy(dest
, lpInit
, sizeof(lpInit
));
715 dwRet
= pSHUnicodeToUnicode(lpSrc
, dest
, sizeof(dest
)/sizeof(dest
[0]));
716 ok(dwRet
== 6 && !memcmp(dest
, lpRes
, sizeof(dest
)),
717 "SHUnicodeToUnicode: expected 6, \"hello\\0\\n\\n\", got %ld, \"%d,%d,%d,%d,%d,%d,%d,%d\"\n",
718 dwRet
, dest
[0], dest
[1], dest
[2], dest
[3], dest
[4], dest
[5], dest
[6], dest
[7]);
725 hShlwapi
= GetModuleHandleA("shlwapi");
743 /* this test fails on locales which do not use '.' as a decimal separator */
744 test_StrFormatByteSize64A();
746 /* this test fails on locales which do not use '.' as a decimal separator */
747 test_StrFormatKBSizeA();
749 /* FIXME: Awaiting NLS fixes in kernel before these succeed */
750 test_StrFormatKBSizeW();
752 test_StrFromTimeIntervalA();
759 test_SHUnicodeToUnicode();