summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaled@aliftype.com>2023-03-05 10:21:40 +0200
committerKhaled Hosny <khaled@aliftype.com>2023-03-05 10:21:40 +0200
commit2ef3fb791b6ddffa56b6809e589be41f160a8a8a (patch)
tree47a77592e9627e15f291bfed38da8e1ebaf029cd
parent818b549bafbaef9323ceedffb3930113ae008af7 (diff)
downloadpango-testmatrix-float.tar.gz
testmatrix.c: Don’t use g_assert_cmphex() with floatstestmatrix-float
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.
-rw-r--r--tests/testmatrix.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/testmatrix.c b/tests/testmatrix.c
index 1ba79839..3bbca282 100644
--- a/tests/testmatrix.c
+++ b/tests/testmatrix.c
@@ -194,20 +194,20 @@ test_matrix_slant_ratio (void)
double r;
r = pango_matrix_get_slant_ratio (&m);
- g_assert_cmphex (r, ==, 0.2);
+ g_assert_cmpfloat (r, ==, 0.2);
pango_matrix_rotate (&m, 45);
r = pango_matrix_get_slant_ratio (&m);
- g_assert_cmphex (r, ==, 0.2);
+ g_assert_cmpfloat (r, ==, 0.2);
pango_matrix_scale (&m, 2, 3);
r = pango_matrix_get_slant_ratio (&m);
- g_assert_cmphex (r, ==, 0.2);
+ g_assert_cmpfloat (r, ==, 0.2);
r = pango_matrix_get_slant_ratio (&m2);
- g_assert_cmphex (r, ==, 0.4);
+ g_assert_cmpfloat (r, ==, 0.4);
}
int