Commit 94b5ccef authored by Myah Caron's avatar Myah Caron Committed by Alexandre Julliard

kernelbase/tests: Add test for Sleep(1).

Sleep(1) should sleep until the next kernel tick, not necessarily one millisecond. Thanks to Henri Verbeet for pointing this out. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49564Signed-off-by: 's avatarMyah Caron <qsniyg@protonmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 23cc3003
......@@ -172,6 +172,31 @@ static void test_WaitOnAddress(void)
ok(!address, "got unexpected value %s\n", wine_dbgstr_longlong(address));
}
static void test_Sleep(void)
{
LARGE_INTEGER frequency;
LARGE_INTEGER t1, t2;
double elapsed_time;
BOOL ret;
int i;
ret = QueryPerformanceFrequency(&frequency);
ok(ret, "QueryPerformanceFrequency failed\n");
ret = QueryPerformanceCounter(&t1);
ok(ret, "QueryPerformanceCounter failed\n");
for (i = 0; i < 100; i++) {
Sleep(1);
}
ret = QueryPerformanceCounter(&t2);
ok(ret, "QueryPerformanceCounter failed\n");
elapsed_time = (t2.QuadPart - t1.QuadPart) / (double)frequency.QuadPart;
todo_wine ok(elapsed_time >= 1.5 && elapsed_time <= 4.0, "got %f\n", elapsed_time);
}
START_TEST(sync)
{
HMODULE hmod;
......@@ -186,4 +211,5 @@ START_TEST(sync)
pWakeByAddressSingle = (void *)GetProcAddress(hmod, "WakeByAddressSingle");
test_WaitOnAddress();
test_Sleep();
}
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