Commit ec139895 authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed some tests that were failing under Wine.

parent 9f0ff1bf
...@@ -3,6 +3,7 @@ atom.ok ...@@ -3,6 +3,7 @@ atom.ok
directory.ok directory.ok
file.ok file.ok
kernel32_test.exe.spec.c kernel32_test.exe.spec.c
locale.ok
path.ok path.ok
process.ok process.ok
testlist.c testlist.c
......
...@@ -97,12 +97,14 @@ LCID lcid; ...@@ -97,12 +97,14 @@ LCID lcid;
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT ); lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT );
strcpy(format, "tt HH':'mm'@'ss"); strcpy(format, "tt HH':'mm'@'ss");
/* fill curtime with dummy data */ todo_wine {
memset(&curtime, 2, sizeof(SYSTEMTIME)); /* fill curtime with dummy data */
ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, sizeof(buffer)); memset(&curtime, 2, sizeof(SYSTEMTIME));
error = GetLastError (); ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, sizeof(buffer));
ok (ret == 0, "GetTimeFormat should fail on dummy data"); error = GetLastError ();
eq (error, ERROR_INVALID_PARAMETER, "GetTimeFormat GetLastError()", "%d"); ok (ret == 0, "GetTimeFormat should fail on dummy data");
eq (error, ERROR_INVALID_PARAMETER, "GetTimeFormat GetLastError()", "%d");
}
strcpy(Expected, "AM 08:56@13"); strcpy(Expected, "AM 08:56@13");
curtime.wHour = 8; curtime.wMinute = 56; curtime.wHour = 8; curtime.wMinute = 56;
...@@ -118,14 +120,14 @@ LCID lcid; ...@@ -118,14 +120,14 @@ LCID lcid;
ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, 0); ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, 0);
cmp = strncmp (Expected, buffer, 4); cmp = strncmp (Expected, buffer, 4);
ok (cmp == 0, "GetTimeFormat with len=0 got %s instead of %s", buffer, Expected); ok (cmp == 0, "GetTimeFormat with len=0 got %s instead of %s", buffer, Expected);
eq (ret, 12, "GetTimeFormat with len=0", "%d"); todo_wine { eq (ret, 12, "GetTimeFormat with len=0", "%d"); }
memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) ); memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) );
strcpy(Expected, "AMxx"); strcpy(Expected, "AMxx");
ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, 2); ret = GetTimeFormatA(lcid, TIME_FORCE24HOURFORMAT, &curtime, format, buffer, 2);
cmp = strncmp (Expected, buffer, 4); cmp = strncmp (Expected, buffer, 4);
ok (cmp == 0, "GetTimeFormat with len=2 got %s instead of %s", buffer, Expected); todo_wine { ok (cmp == 0, "GetTimeFormat with len=2 got %s instead of %s", buffer, Expected); }
eq (ret, 0, "GetTimeFormat with len=0", "%d"); eq (ret, 0, "GetTimeFormat with len=2", "%d");
} }
void TestGetDateFormatA() void TestGetDateFormatA()
...@@ -138,13 +140,15 @@ LCID lcid; ...@@ -138,13 +140,15 @@ LCID lcid;
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT ); lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT );
strcpy(format, "ddd',' MMM dd yy"); strcpy(format, "ddd',' MMM dd yy");
/* fill curtime with dummy data */ todo_wine {
memset(&curtime, 2, sizeof(SYSTEMTIME)); /* fill curtime with dummy data */
memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) ); memset(&curtime, 2, sizeof(SYSTEMTIME));
ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer)); memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) );
error = GetLastError (); ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer));
ok (ret== 0, "GetDateFormat should fail on dummy data"); error = GetLastError ();
eq (error, ERROR_INVALID_PARAMETER, "GetDateFormat", "%d"); ok (ret== 0, "GetDateFormat should fail on dummy data");
eq (error, ERROR_INVALID_PARAMETER, "GetDateFormat", "%d");
}
strcpy(Expected, "Sat, May 04 02"); strcpy(Expected, "Sat, May 04 02");
memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) ); memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) );
...@@ -154,7 +158,7 @@ LCID lcid; ...@@ -154,7 +158,7 @@ LCID lcid;
curtime.wDayOfWeek = 3; curtime.wDayOfWeek = 3;
ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer)); ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer));
cmp = strncmp (Expected, buffer, strlen(Expected)+1); cmp = strncmp (Expected, buffer, strlen(Expected)+1);
ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); todo_wine { ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); }
eq (ret, strlen(Expected)+1, "GetDateFormat", "%d"); eq (ret, strlen(Expected)+1, "GetDateFormat", "%d");
/* test format with "'" */ /* test format with "'" */
...@@ -163,7 +167,7 @@ LCID lcid; ...@@ -163,7 +167,7 @@ LCID lcid;
strcpy(Expected, "Sat, May 04 '02"); strcpy(Expected, "Sat, May 04 '02");
ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer)); ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, sizeof(buffer));
cmp = strncmp (Expected, buffer, strlen(Expected)+1); cmp = strncmp (Expected, buffer, strlen(Expected)+1);
ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); todo_wine { ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); }
eq (ret, (strlen(Expected)+1), "GetDateFormat", "%d"); eq (ret, (strlen(Expected)+1), "GetDateFormat", "%d");
/* test with too small buffers */ /* test with too small buffers */
...@@ -172,13 +176,13 @@ LCID lcid; ...@@ -172,13 +176,13 @@ LCID lcid;
ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, 0); ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, 0);
cmp = strncmp (Expected, buffer, 4); cmp = strncmp (Expected, buffer, 4);
ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected);
eq (ret, 16, "GetDateFormat with len=0", "%d"); todo_wine { eq (ret, 16, "GetDateFormat with len=0", "%d"); }
memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) ); memset(buffer, 'x', sizeof (buffer)/sizeof(buffer[0]) );
strcpy(Expected, "Saxx"); strcpy(Expected, "Saxx");
ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, 2); ret = GetDateFormatA(lcid, 0, &curtime, format, buffer, 2);
cmp = strncmp (Expected, buffer, 4); cmp = strncmp (Expected, buffer, 4);
ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); todo_wine { ok (cmp == 0, "GetDateFormat got %s instead of %s", buffer, Expected); }
eq (ret, 0, "GetDateFormat with len=2", "%d"); eq (ret, 0, "GetDateFormat with len=2", "%d");
} }
...@@ -304,28 +308,28 @@ char buffer1[BUFFER_SIZE], buffer2[BUFFER_SIZE]; ...@@ -304,28 +308,28 @@ char buffer1[BUFFER_SIZE], buffer2[BUFFER_SIZE];
lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT ); lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT );
strcpy(buffer1, "Salut"); strcpy(buffer2, "Salute"); strcpy(buffer1, "Salut"); strcpy(buffer2, "Salute");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, BUFFER_SIZE); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, -1);
ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2); ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2);
strcpy(buffer1, "Salut"); strcpy(buffer2, "saLuT"); strcpy(buffer1, "Salut"); strcpy(buffer2, "saLuT");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, BUFFER_SIZE); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, -1);
ok (ret== 2, "CompareStringA (st1=%s str2=%s) expected result=2", buffer1, buffer2); ok (ret== 2, "CompareStringA (st1=%s str2=%s) expected result=2", buffer1, buffer2);
strcpy(buffer1, "Salut"); strcpy(buffer2, "hola"); strcpy(buffer1, "Salut"); strcpy(buffer2, "hola");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, BUFFER_SIZE); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, -1);
ok (ret== 3, "CompareStringA (st1=%s str2=%s) expected result=3", buffer1, buffer2); ok (ret== 3, "CompareStringA (st1=%s str2=%s) expected result=3", buffer1, buffer2);
strcpy(buffer1, "hh"); strcpy(buffer2, "hh"); strcpy(buffer1, "hh"); strcpy(buffer2, "hh");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, BUFFER_SIZE); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, -1);
ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2); ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2);
lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT ); lcid = MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT );
strcpy(buffer1, "hh"); strcpy(buffer2, "hh"); strcpy(buffer1, "hh"); strcpy(buffer2, "hh");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, BUFFER_SIZE); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, -1);
ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2); ok (ret== 1, "CompareStringA (st1=%s str2=%s) expected result=1", buffer1, buffer2);
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, BUFFER_SIZE, buffer2, 0); ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, 0);
ok (ret== 3, "CompareStringA (st1=%s str2=%s) expected result=3", buffer1, buffer2); ok (ret== 3, "CompareStringA (st1=%s str2=%s) expected result=3", buffer1, buffer2);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment