Commit d0319e20 authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

ucrtbase: Expand tests for strftime format %g.

parent ac8d5f71
...@@ -927,7 +927,7 @@ static void test_strftime(void) ...@@ -927,7 +927,7 @@ static void test_strftime(void)
const char *format; const char *format;
const char *ret; const char *ret;
struct tm tm; struct tm tm;
BOOL todo; BOOL todo_value;
BOOL todo_handler; BOOL todo_handler;
} tests[] = { } tests[] = {
{"%C", "", { 0, 0, 0, 1, 0, -2000, 4, 0, 0 }}, {"%C", "", { 0, 0, 0, 1, 0, -2000, 4, 0, 0 }},
...@@ -974,26 +974,33 @@ static void test_strftime(void) ...@@ -974,26 +974,33 @@ static void test_strftime(void)
{"%I", "11", { 0, 0, 23, 1, 0, 70, 4, 0, 0 }}, {"%I", "11", { 0, 0, 23, 1, 0, 70, 4, 0, 0 }},
{"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }}, {"%I", "", { 0, 0, 24, 1, 0, 70, 4, 0, 0 }},
{"%n", "\n", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%n", "\n", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%r", "12:00:00 AM", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE}, {"%r", "12:00:00 AM", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE, TRUE},
{"%r", "02:00:00 PM", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE}, {"%r", "02:00:00 PM", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE, TRUE},
{"%t", "\t", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%t", "\t", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%g", "", { 0, 0, 0, 1, 0, -1901, 4, 0, 0 }, TRUE},
{"%g", "", { 0, 0, 0, 1, 0, -1901, 3, 364, 0 }, TRUE, TRUE},
{"%g", "00", { 0, 0, 0, 1, 0, -1900, 4, 0, 0 }},
{"%g", "70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%g", "70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%g", "71", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }},
{"%g", "72", { 0, 0, 0, 3, 0, 72, 1, 2, 0 }},
{"%g", "16", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }}, {"%g", "16", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }},
{"%g", "99", { 0, 0, 0, 1, 0, 8099, 4, 0, 0 }},
{"%g", "00", { 0, 0, 0, 1, 0, 8099, 3, 364, 0 }},
{"%g", "", { 0, 0, 0, 1, 0, 8100, 0, 0, 0 }, TRUE, TRUE},
{"%g", "", { 0, 0, 0, 1, 0, 8100, 4, 0, 0 }, TRUE, TRUE},
{"%G", "1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%G", "1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%G", "1971", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }},
{"%G", "1972", { 0, 0, 0, 3, 0, 72, 1, 2, 0 }},
{"%G", "2016", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }}, {"%G", "2016", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }},
{"%V", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE}, {"%V", "01", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE, TRUE},
{"%V", "52", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }, TRUE}, {"%V", "52", { 0, 0, 0, 1, 0, 117, 0, 0, 0 }, TRUE, TRUE},
{"%V", "53", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE}, {"%V", "53", { 0, 0, 14, 1, 0, 121, 6, 0, 0 }, TRUE, TRUE},
{"%y", "", { 0, 0, 0, 0, 0, -1901, 0, 0, 0 }}, {"%y", "", { 0, 0, 0, 0, 0, -1901, 0, 0, 0 }},
{"%y", "00", { 0, 0, 0, 0, 0, -1900, 0, 0, 0 }}, {"%y", "00", { 0, 0, 0, 0, 0, -1900, 0, 0, 0 }},
{"%y", "99", { 0, 0, 0, 0, 0, 8099, 0, 0, 0 }}, {"%y", "99", { 0, 0, 0, 0, 0, 8099, 0, 0, 0 }},
{"%y", "", { 0, 0, 0, 0, 0, 8100, 0, 0, 0 }}, {"%y", "", { 0, 0, 0, 0, 0, 8100, 0, 0, 0 }},
{"%g", "71", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }}, {"%c", "Thu Jan 1 00:00:00 1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE, TRUE},
{"%g", "72", { 0, 0, 0, 3, 0, 72, 1, 2, 0 }}, {"%c", "Thu Feb 30 00:00:00 1970", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }, TRUE, TRUE},
{"%G", "1971", { 0, 0, 0, 2, 0, 72, 0, 1, 0 }},
{"%G", "1972", { 0, 0, 0, 3, 0, 72, 1, 2, 0 }},
{"%c", "Thu Jan 1 00:00:00 1970", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }, TRUE},
{"%c", "Thu Feb 30 00:00:00 1970", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }, TRUE},
{"%#c", "Thursday, January 01, 1970 00:00:00", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%#c", "Thursday, January 01, 1970 00:00:00", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
{"%#c", "Thursday, February 30, 1970 00:00:00", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }}, {"%#c", "Thursday, February 30, 1970 00:00:00", { 0, 0, 0, 30, 1, 70, 4, 0, 0 }},
{"%x", "01/01/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }}, {"%x", "01/01/70", { 0, 0, 0, 1, 0, 70, 4, 0, 0 }},
...@@ -1091,7 +1098,7 @@ static void test_strftime(void) ...@@ -1091,7 +1098,7 @@ static void test_strftime(void)
for (i=0; i<ARRAY_SIZE(tests); i++) for (i=0; i<ARRAY_SIZE(tests); i++)
{ {
todo_wine_if(tests[i].todo || tests[i].todo_handler) { todo_wine_if(tests[i].todo_handler) {
if (!tests[i].ret[0]) if (!tests[i].ret[0])
SET_EXPECT(global_invalid_parameter_handler); SET_EXPECT(global_invalid_parameter_handler);
ret = p_strftime(buf, sizeof(buf), tests[i].format, &tests[i].tm); ret = p_strftime(buf, sizeof(buf), tests[i].format, &tests[i].tm);
...@@ -1099,7 +1106,7 @@ static void test_strftime(void) ...@@ -1099,7 +1106,7 @@ static void test_strftime(void)
CHECK_CALLED(global_invalid_parameter_handler); CHECK_CALLED(global_invalid_parameter_handler);
} }
todo_wine_if(tests[i].todo) { todo_wine_if(tests[i].todo_value) {
ok(ret == strlen(tests[i].ret), "%d) ret = %d\n", i, ret); ok(ret == strlen(tests[i].ret), "%d) ret = %d\n", i, ret);
ok(!strcmp(buf, tests[i].ret), "%d) buf = \"%s\", expected \"%s\"\n", ok(!strcmp(buf, tests[i].ret), "%d) buf = \"%s\", expected \"%s\"\n",
i, buf, tests[i].ret); i, buf, tests[i].ret);
......
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