glib/tests: fix random failure due to rounding

GLib:ERROR:../glib/tests/timer.c:41:test_timer_basic: assertion failed (micros == ((guint64)(elapsed * 1e6)) % 1000000): (11 == 10)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-02-04 13:11:02 +04:00
parent b3d6946c27
commit 20f8007f73

View File

@ -56,7 +56,7 @@ test_timer_basic (void)
elapsed = g_timer_elapsed (timer, &micros);
g_assert_cmpfloat (elapsed, <, 1.0);
g_assert_cmpuint (micros, ==, ((guint64)(elapsed * 1e6)) % 1000000);
g_assert_cmpfloat_with_epsilon (elapsed, micros / 1e6, 0.001);
g_timer_destroy (timer);
}