quartz/tests: Fix -Wabsolute-value warnings.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cca639fa64
commit
2ad5d4f159
|
@ -41,6 +41,12 @@ typedef struct TestFilterImpl
|
|||
UINT nPins;
|
||||
} TestFilterImpl;
|
||||
|
||||
static BOOL compare_time(ULONGLONG x, ULONGLONG y, unsigned int max_diff)
|
||||
{
|
||||
ULONGLONG diff = x > y ? x - y : y - x;
|
||||
return diff <= max_diff;
|
||||
}
|
||||
|
||||
static WCHAR *create_file(const WCHAR *name, const char *data, DWORD size)
|
||||
{
|
||||
static WCHAR pathW[MAX_PATH];
|
||||
|
@ -4057,13 +4063,13 @@ static void test_graph_seeking(void)
|
|||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(time - 1234 * 10000) < 40 * 10000,
|
||||
ok(compare_time(time, 1234 * 10000, 40 * 10000),
|
||||
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(time));
|
||||
current = stop = 0xdeadbeef;
|
||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(current - 1234 * 10000) < 40 * 10000,
|
||||
ok(compare_time(current, 1234 * 10000, 40 * 10000),
|
||||
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(current));
|
||||
ok(stop == 9000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||
|
||||
|
@ -4080,13 +4086,13 @@ static void test_graph_seeking(void)
|
|||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(time - 1334 * 10000) < 80 * 10000,
|
||||
ok(compare_time(time, 1334 * 10000, 80 * 10000),
|
||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
|
||||
current = stop = 0xdeadbeef;
|
||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(current - 1334 * 10000) < 80 * 10000,
|
||||
ok(compare_time(current, 1334 * 10000, 80 * 10000),
|
||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
|
||||
ok(stop == 8000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||
|
||||
|
@ -4100,13 +4106,13 @@ static void test_graph_seeking(void)
|
|||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(time - 1334 * 10000) < 80 * 10000,
|
||||
ok(compare_time(time, 1334 * 10000, 80 * 10000),
|
||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
|
||||
current = stop = 0xdeadbeef;
|
||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
if (winetest_interactive) /* Timing problems make this test too liable to fail. */
|
||||
ok(abs(current - 1334 * 10000) < 80 * 10000,
|
||||
ok(compare_time(current, 1334 * 10000, 80 * 10000),
|
||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
|
||||
ok(stop == 8000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||
|
||||
|
|
|
@ -24,6 +24,12 @@
|
|||
|
||||
static ULONGLONG (WINAPI *pGetTickCount64)(void);
|
||||
|
||||
static BOOL compare_time(REFERENCE_TIME x, REFERENCE_TIME y, unsigned int max_diff)
|
||||
{
|
||||
REFERENCE_TIME diff = x > y ? x - y : y - x;
|
||||
return diff <= max_diff;
|
||||
}
|
||||
|
||||
static IReferenceClock *create_system_clock(void)
|
||||
{
|
||||
IReferenceClock *clock = NULL;
|
||||
|
@ -181,7 +187,7 @@ static void test_get_time(void)
|
|||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(time1 % 10000 == 0, "Expected no less than 1ms coarseness, but got time %s.\n",
|
||||
wine_dbgstr_longlong(time1));
|
||||
ok(abs(time1 - time2) < 20 * 10000, "Expected about %s, got %s.\n",
|
||||
ok(compare_time(time1, time2, 20 * 10000), "Expected about %s, got %s.\n",
|
||||
wine_dbgstr_longlong(time2), wine_dbgstr_longlong(time1));
|
||||
|
||||
hr = IReferenceClock_GetTime(clock, &time2);
|
||||
|
|
|
@ -73,18 +73,19 @@ static inline BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TY
|
|||
|
||||
static BOOL compare_double(double f, double g, unsigned int ulps)
|
||||
{
|
||||
int64_t x = *(int64_t *)&f;
|
||||
int64_t y = *(int64_t *)&g;
|
||||
uint64_t x = *(ULONGLONG *)&f;
|
||||
uint64_t y = *(ULONGLONG *)&g;
|
||||
|
||||
if (x < 0)
|
||||
x = INT64_MIN - x;
|
||||
if (y < 0)
|
||||
y = INT64_MIN - y;
|
||||
if (f < 0)
|
||||
x = ~x + 1;
|
||||
else
|
||||
x |= ((ULONGLONG)1)<<63;
|
||||
if (g < 0)
|
||||
y = ~y + 1;
|
||||
else
|
||||
y |= ((ULONGLONG)1)<<63;
|
||||
|
||||
if (abs(x - y) > ulps)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return (x>y ? x-y : y-x) <= ulps;
|
||||
}
|
||||
|
||||
static IFilterGraph2 *create_graph(void)
|
||||
|
|
Loading…
Reference in New Issue