ucrtbase/tests: Add tests for strftime formats %r and %V.

Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vijay Kiran Kamuju 2019-11-01 10:16:05 +01:00 committed by Alexandre Julliard
parent fde9de91df
commit ea1398382c
1 changed files with 21 additions and 0 deletions

View File

@ -904,6 +904,7 @@ static void test_strftime(void)
{ {
const struct tm epoch = { 0, 0, 0, 1, 0, 70, 4, 0, 0 }; const struct tm epoch = { 0, 0, 0, 1, 0, 70, 4, 0, 0 };
const struct tm tm1 = { 0, 0, 0, 1, 0, 117, 0, 0, 0 }; const struct tm tm1 = { 0, 0, 0, 1, 0, 117, 0, 0, 0 };
const struct tm tm2 = { 0, 0, 14, 1, 0, 121, 6, 0, 0 };
char bufA[256]; char bufA[256];
size_t retA; size_t retA;
int i; int i;
@ -964,6 +965,14 @@ static void test_strftime(void)
ok(retA == 1, "expected 1, got %d\n", (int)retA); ok(retA == 1, "expected 1, got %d\n", (int)retA);
ok(!strcmp(bufA, "\n"), "got %s\n", bufA); ok(!strcmp(bufA, "\n"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%r", &epoch);
todo_wine ok(retA == 11, "expected 11, got %d\n", (int)retA);
todo_wine ok(!strcmp(bufA, "12:00:00 AM"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%r", &tm2);
todo_wine ok(retA == 11, "expected 11, got %d\n", (int)retA);
todo_wine ok(!strcmp(bufA, "02:00:00 PM"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%t", &epoch); retA = p_strftime(bufA, sizeof(bufA), "%t", &epoch);
ok(retA == 1, "expected 1, got %d\n", (int)retA); ok(retA == 1, "expected 1, got %d\n", (int)retA);
ok(!strcmp(bufA, "\t"), "got %s\n", bufA); ok(!strcmp(bufA, "\t"), "got %s\n", bufA);
@ -984,6 +993,18 @@ static void test_strftime(void)
ok(retA == 4, "expected 4, got %d\n", (int)retA); ok(retA == 4, "expected 4, got %d\n", (int)retA);
ok(!strcmp(bufA, "2016"), "got %s\n", bufA); ok(!strcmp(bufA, "2016"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%V", &epoch);
todo_wine ok(retA == 2, "expected 2, got %d\n", (int)retA);
todo_wine ok(!strcmp(bufA, "01"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%V", &tm1);
todo_wine ok(retA == 2, "expected 2, got %d\n", (int)retA);
todo_wine ok(!strcmp(bufA, "52"), "got %s\n", bufA);
retA = p_strftime(bufA, sizeof(bufA), "%V", &tm2);
todo_wine ok(retA == 2, "expected 2, got %d\n", (int)retA);
todo_wine ok(!strcmp(bufA, "53"), "got %s\n", bufA);
for(i=0; i<14; i++) for(i=0; i<14; i++)
{ {
__time32_t t = (365*2 + i - 7) * 24 * 60 * 60; __time32_t t = (365*2 + i - 7) * 24 * 60 * 60;