test_resource_get_set_simple: 'tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6' should be TRUE
As mentioned on Matrix, we encountered some issues in the float comparison:
stdout:
# random seed: R02S717bb58fb461507f187fa3b23cbfee59
# Testing Tracker resource abstraction
1..6
# Start of libtracker-sparql tests
# Start of tracker-resource tests
ok 1 /libtracker-sparql/tracker-resource/get_empty
Bail out! Tracker:ERROR:../tests/libtracker-sparql/tracker-resource-test.c:61:test_resource_get_set_simple: 'tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6' should be TRUE
stderr:
**
Tracker:ERROR:../tests/libtracker-sparql/tracker-resource-test.c:61:test_resource_get_set_simple: 'tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6' should be TRUE
Changing the line to g_assert_cmpfloat
revealed that the values are the same, at least for printing purposes:
Tracker:ERROR:../tests/libtracker-sparql/tracker-resource-test.c:61:test_resource_get_set_simple: assertion failed (tracker_resource_get_first_double (resource, "http://example.com/1") == 0.6): (0.6 == 0.6)
The solution is likely to use g_assert_cmpfloat_with_epsilon
for comparison, though I am not sure what epsilon value is suitable. Reading https://bitbashing.io/comparing-floats.html, FLT_EPSILON
should be sufficient since the values compared are below 1 but it might be too loose.
This is with tracker 3.2.0 on GNOME 41 on NixOS.
Downstream reports: