Skip to content

testmatrix.c: Don’t use g_assert_cmphex() with floats

Khaled Hosny requested to merge testmatrix-float into main

The build was giving this warning:

../tests/testmatrix.c:197:27: warning: implicit conversion from 'double' to 'guint64' (aka 'unsigned long long') changes value from 0.2 to 0 [-Wliteral-conversion]
  g_assert_cmphex (r, ==, 0.2);
  ~~~~~~~~~~~~~~~~~~~~~~~~^~~~

So the test was effectively comparing 0 to 0.

I switched to g_assert_cmpfloat(), but now the tests are failing as the values don’t mach. I don’t know which is wrong, the expected value or the code being tested.

Edited by Khaled Hosny

Merge request reports