Andrew Nguyen : shlwapi/tests: Fix Win98 SE test failures for StrFormatKBSizeA/W.

Alexandre Julliard julliard at winehq.org
Mon Jul 19 11:05:43 CDT 2010


Module: wine
Branch: master
Commit: ec0e9d0df87324d4d8c9d332d4f41d6c15ffe6f9
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ec0e9d0df87324d4d8c9d332d4f41d6c15ffe6f9

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Sun Jul 18 19:33:14 2010 -0500

shlwapi/tests: Fix Win98 SE test failures for StrFormatKBSizeA/W.

---

 dlls/shlwapi/tests/string.c |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/dlls/shlwapi/tests/string.c b/dlls/shlwapi/tests/string.c
index 17c652d..b8cf7e0 100644
--- a/dlls/shlwapi/tests/string.c
+++ b/dlls/shlwapi/tests/string.c
@@ -107,6 +107,8 @@ typedef struct tagStrFormatSizeResult
   LONGLONG value;
   const char* byte_size_64;
   const char* kb_size;
+  int kb_size_broken;
+  const char* kb_size2;
 } StrFormatSizeResult;
 
 
@@ -117,15 +119,15 @@ static const StrFormatSizeResult StrFormatSize_results[] = {
   { 10191, "9.95 KB", "10 KB"},
   { 100353, "98.0 KB", "99 KB"},
   { 1022286, "998 KB", "999 KB"},
-  { 1046862, "0.99 MB", "1,023 KB"},
-  { 1048574619, "999 MB", "1,023,999 KB"},
-  { 1073741775, "0.99 GB", "1,048,576 KB"},
-  { ((LONGLONG)0x000000f9 << 32) | 0xfffff94e, "999 GB", "1,048,575,999 KB"},
-  { ((LONGLONG)0x000000ff << 32) | 0xfffffa9b, "0.99 TB", "1,073,741,823 KB"},
-  { ((LONGLONG)0x0003e7ff << 32) | 0xfffffa9b, "999 TB", "1,073,741,823,999 KB"},
-  { ((LONGLONG)0x0003ffff << 32) | 0xfffffbe8, "0.99 PB", "1,099,511,627,775 KB"},
-  { ((LONGLONG)0x0f9fffff << 32) | 0xfffffd35, "999 PB", "1,099,511,627,776,000 KB"},
-  { ((LONGLONG)0x0fffffff << 32) | 0xfffffa9b, "0.99 EB", "1,125,899,906,842,623 KB"},
+  { 1046862, "0.99 MB", "1,023 KB", 1, "1023 KB"},
+  { 1048574619, "999 MB", "1,023,999 KB", 1, "1023999 KB"},
+  { 1073741775, "0.99 GB", "1,048,576 KB", 1, "1048576 KB"},
+  { ((LONGLONG)0x000000f9 << 32) | 0xfffff94e, "999 GB", "1,048,575,999 KB", 1, "1048575999 KB"},
+  { ((LONGLONG)0x000000ff << 32) | 0xfffffa9b, "0.99 TB", "1,073,741,823 KB", 1, "1073741823 KB"},
+  { ((LONGLONG)0x0003e7ff << 32) | 0xfffffa9b, "999 TB", "1,073,741,823,999 KB", 1, "4294967295 KB"},
+  { ((LONGLONG)0x0003ffff << 32) | 0xfffffbe8, "0.99 PB", "1,099,511,627,775 KB", 1, "4294967295 KB"},
+  { ((LONGLONG)0x0f9fffff << 32) | 0xfffffd35, "999 PB", "1,099,511,627,776,000 KB", 1, "0 KB"},
+  { ((LONGLONG)0x0fffffff << 32) | 0xfffffa9b, "0.99 EB", "1,125,899,906,842,623 KB", 1, "4294967295 KB"},
   { 0, NULL, NULL }
 };
 
@@ -560,7 +562,11 @@ static void test_StrFormatKBSizeW(void)
   {
     pStrFormatKBSizeW(result->value, szBuffW, 256);
     WideCharToMultiByte(0,0,szBuffW,-1,szBuff,sizeof(szBuff)/sizeof(WCHAR),0,0);
-    ok(!strcmp(result->kb_size, szBuff),
+
+    /* shlwapi on Win98 SE does not appear to apply delimiters to the output
+     * and does not correctly handle extremely large values. */
+    ok(!strcmp(result->kb_size, szBuff) ||
+      (result->kb_size_broken && !strcmp(result->kb_size2, szBuff)),
         "Formatted %x%08x wrong: got %s, expected %s\n",
        (LONG)(result->value >> 32), (LONG)result->value, szBuff, result->kb_size);
     result++;
@@ -582,7 +588,10 @@ static void test_StrFormatKBSizeA(void)
   {
     pStrFormatKBSizeA(result->value, szBuff, 256);
 
-    ok(!strcmp(result->kb_size, szBuff),
+    /* shlwapi on Win98 SE does not appear to apply delimiters to the output
+     * and does not correctly handle extremely large values. */
+    ok(!strcmp(result->kb_size, szBuff) ||
+      (result->kb_size_broken && !strcmp(result->kb_size2, szBuff)),
         "Formatted %x%08x wrong: got %s, expected %s\n",
        (LONG)(result->value >> 32), (LONG)result->value, szBuff, result->kb_size);
     result++;




More information about the wine-cvs mailing list