[PATCH] kernel32/tests: Add a test for GetTickCount().
Huw Davies
huw at codeweavers.com
Fri Jun 14 05:50:30 CDT 2019
Signed-off-by: Huw Davies <huw at codeweavers.com>
---
dlls/kernel32/tests/time.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/kernel32/tests/time.c b/dlls/kernel32/tests/time.c
index 536f23359b..5faabd36e1 100644
--- a/dlls/kernel32/tests/time.c
+++ b/dlls/kernel32/tests/time.c
@@ -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();
}
--
2.18.0
More information about the wine-devel
mailing list