[tracker: 1/2] [test] Refactor double comparison




commit af707181a2c492a794daec7ce3f3062d67ffd9dc
Author: Fabián Heredia Montiel <fabianhjr protonmail com>
Date:   Fri Oct 15 15:50:58 2021 -0500

    [test] Refactor double comparison
    
    Fixes https://gitlab.gnome.org/GNOME/tracker/-/issues/332
    
    There were some issues downstreams were the equality comparison failed
    on some platforms like i686

 tests/libtracker-sparql/tracker-resource-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/tests/libtracker-sparql/tracker-resource-test.c b/tests/libtracker-sparql/tracker-resource-test.c
index eb22fa927..dfd7ab188 100644
--- a/tests/libtracker-sparql/tracker-resource-test.c
+++ b/tests/libtracker-sparql/tracker-resource-test.c
@@ -58,7 +58,7 @@ test_resource_get_set_simple (void)
        tracker_resource_set_uri (resource, "http://example.com/5";, "http://example.com/";);
        tracker_resource_set_datetime (resource, "http://example.com/6";, date_time);
 
-       g_assert_true (tracker_resource_get_first_double (resource, "http://example.com/1";) == 0.6);
+       g_assert_cmpfloat_with_epsilon (tracker_resource_get_first_double (resource, "http://example.com/1";), 
0.6, DBL_EPSILON);
        g_assert_cmpint (tracker_resource_get_first_int (resource, "http://example.com/2";), ==, 60);
        g_assert_true (tracker_resource_get_first_int64 (resource, "http://example.com/3";) == 123456789);
        g_assert_cmpstr (tracker_resource_get_first_string (resource, "http://example.com/4";), ==, "Hello");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]