kernel32/tests: Boundary test cases for SystemTimeToFileTime and GetDateFormat.
This commit is contained in:
parent
b7019a7a64
commit
a70df444ae
|
@ -424,6 +424,34 @@ static void test_GetDateFormatW(void)
|
||||||
STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002"); /* Incorrect DOW and time */
|
STRINGSW("dddd d MMMM yyyy","Wednesday 23 October 2002"); /* Incorrect DOW and time */
|
||||||
ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
|
ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
|
||||||
EXPECT_VALID; EXPECT_LENW; EXPECT_EQW;
|
EXPECT_VALID; EXPECT_LENW; EXPECT_EQW;
|
||||||
|
|
||||||
|
/* Limit tests */
|
||||||
|
|
||||||
|
curtime.wYear = 1601;
|
||||||
|
curtime.wMonth = 1;
|
||||||
|
curtime.wDay = 1;
|
||||||
|
curtime.wDayOfWeek = 0; /* Irrelevant */
|
||||||
|
curtime.wHour = 0;
|
||||||
|
curtime.wMinute = 0;
|
||||||
|
curtime.wSecond = 0;
|
||||||
|
curtime.wMilliseconds = 0;
|
||||||
|
STRINGSW("dddd d MMMM yyyy","Monday 1 January 1601");
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
|
||||||
|
EXPECT_VALID; EXPECT_LENW; EXPECT_EQW;
|
||||||
|
|
||||||
|
curtime.wYear = 1600;
|
||||||
|
curtime.wMonth = 12;
|
||||||
|
curtime.wDay = 31;
|
||||||
|
curtime.wDayOfWeek = 0; /* Irrelevant */
|
||||||
|
curtime.wHour = 23;
|
||||||
|
curtime.wMinute = 59;
|
||||||
|
curtime.wSecond = 59;
|
||||||
|
curtime.wMilliseconds = 999;
|
||||||
|
STRINGSW("dddd d MMMM yyyy","Friday 31 December 1600");
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
ret = GetDateFormatW (lcid, 0, &curtime, input, buffer, COUNTOF(buffer));
|
||||||
|
EXPECT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,23 @@
|
||||||
(st).wSecond = 32; \
|
(st).wSecond = 32; \
|
||||||
(st).wMilliseconds = 123;
|
(st).wMilliseconds = 123;
|
||||||
|
|
||||||
|
#define SETUP_ZEROTIME(st) \
|
||||||
|
(st).wYear = 1601; \
|
||||||
|
(st).wMonth = 1; \
|
||||||
|
(st).wDay = 1; \
|
||||||
|
(st).wHour = 0; \
|
||||||
|
(st).wMinute = 0; \
|
||||||
|
(st).wSecond = 0; \
|
||||||
|
(st).wMilliseconds = 0;
|
||||||
|
|
||||||
|
#define SETUP_EARLY(st) \
|
||||||
|
(st).wYear = 1600; \
|
||||||
|
(st).wMonth = 12; \
|
||||||
|
(st).wDay = 31; \
|
||||||
|
(st).wHour = 23; \
|
||||||
|
(st).wMinute = 59; \
|
||||||
|
(st).wSecond = 59; \
|
||||||
|
(st).wMilliseconds = 999;
|
||||||
|
|
||||||
|
|
||||||
static void test_conversions(void)
|
static void test_conversions(void)
|
||||||
|
@ -82,6 +99,17 @@ static void test_conversions(void)
|
||||||
|
|
||||||
memset(&ft,0,sizeof ft);
|
memset(&ft,0,sizeof ft);
|
||||||
|
|
||||||
|
SETUP_EARLY(st)
|
||||||
|
ok (!SystemTimeToFileTime(&st, &ft), "Conversion succeeded EARLY\n");
|
||||||
|
ok (GetLastError() == ERROR_INVALID_PARAMETER, "EARLY should be INVALID\n");
|
||||||
|
|
||||||
|
SETUP_ZEROTIME(st)
|
||||||
|
ok (SystemTimeToFileTime(&st, &ft), "Conversion failed ZERO_TIME\n");
|
||||||
|
ok( (!((ft.dwHighDateTime != 0) || (ft.dwLowDateTime != 0))),
|
||||||
|
"Wrong time for ATIME: %08x %08x (correct %08x %08x)\n",
|
||||||
|
ft.dwLowDateTime, ft.dwHighDateTime, 0, 0);
|
||||||
|
|
||||||
|
|
||||||
SETUP_ATIME(st)
|
SETUP_ATIME(st)
|
||||||
ok (SystemTimeToFileTime(&st,&ft), "Conversion Failed ATIME\n");
|
ok (SystemTimeToFileTime(&st,&ft), "Conversion Failed ATIME\n");
|
||||||
ok( (!((ft.dwHighDateTime != ATIME_HI) || (ft.dwLowDateTime!=ATIME_LOW))),
|
ok( (!((ft.dwHighDateTime != ATIME_HI) || (ft.dwLowDateTime!=ATIME_LOW))),
|
||||||
|
|
Loading…
Reference in New Issue