[glib: 5/9] glib/tests: fix random failure due to rounding
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 5/9] glib/tests: fix random failure due to rounding
- Date: Mon, 21 Mar 2022 12:19:27 +0000 (UTC)
commit 20f8007f73bcd2ffcfbb6f2c2b4fbb494be20c7e
Author: Marc-André Lureau <marcandre lureau redhat com>
Date: Fri Feb 4 13:11:02 2022 +0400
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>
glib/tests/timer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/tests/timer.c b/glib/tests/timer.c
index 102406ef3..42ed5a92c 100644
--- a/glib/tests/timer.c
+++ b/glib/tests/timer.c
@@ -56,7 +56,7 @@ test_timer_basic (void)
elapsed = g_timer_elapsed (timer, µs);
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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]