kernel32/tests: Add a test for GetTickCount().

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2019-06-14 11:50:30 +01:00 committed by Alexandre Julliard
parent b56fb67311
commit 2706b94dd0
1 changed files with 26 additions and 0 deletions

View File

@ -32,6 +32,7 @@ static int (WINAPI *pGetCalendarInfoW)(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD);
static DWORD (WINAPI *pGetDynamicTimeZoneInformation)(DYNAMIC_TIME_ZONE_INFORMATION*);
static void (WINAPI *pGetSystemTimePreciseAsFileTime)(LPFILETIME);
static BOOL (WINAPI *pGetTimeZoneInformationForYear)(USHORT, PDYNAMIC_TIME_ZONE_INFORMATION, LPTIME_ZONE_INFORMATION);
static ULONG (WINAPI *pNtGetTickCount)(void);
#define SECSPERMIN 60
#define SECSPERDAY 86400
@ -1004,9 +1005,32 @@ static void test_GetTimeZoneInformationForYear(void)
"GetTimeZoneInformationForYear err %u\n", GetLastError());
}
static void test_GetTickCount(void)
{
DWORD t1, t2, t3;
int i = 0;
if (!pNtGetTickCount)
{
win_skip("NtGetTickCount not implemented\n");
return;
}
do
{
t1 = pNtGetTickCount();
t2 = GetTickCount();
t3 = pNtGetTickCount();
} while(t3 < t1 && i++ < 1); /* allow for wrap, but only once */
ok(t1 <= t2, "out of order %d %d\n", t1, t2);
ok(t2 <= t3, "out of order %d %d\n", t2, t3);
}
START_TEST(time)
{
HMODULE hKernel = GetModuleHandleA("kernel32");
HMODULE hntdll = GetModuleHandleA("ntdll");
pTzSpecificLocalTimeToSystemTime = (void *)GetProcAddress(hKernel, "TzSpecificLocalTimeToSystemTime");
pSystemTimeToTzSpecificLocalTime = (void *)GetProcAddress( hKernel, "SystemTimeToTzSpecificLocalTime");
pGetSystemTimes = (void *)GetProcAddress( hKernel, "GetSystemTimes");
@ -1015,6 +1039,7 @@ START_TEST(time)
pGetDynamicTimeZoneInformation = (void *)GetProcAddress(hKernel, "GetDynamicTimeZoneInformation");
pGetSystemTimePreciseAsFileTime = (void *)GetProcAddress(hKernel, "GetSystemTimePreciseAsFileTime");
pGetTimeZoneInformationForYear = (void *)GetProcAddress(hKernel, "GetTimeZoneInformationForYear");
pNtGetTickCount = (void *)GetProcAddress(hntdll, "NtGetTickCount");
test_conversions();
test_invalid_arg();
@ -1029,4 +1054,5 @@ START_TEST(time)
test_GetSystemTimeAsFileTime();
test_GetSystemTimePreciseAsFileTime();
test_GetTimeZoneInformationForYear();
test_GetTickCount();
}