[mutter/gbsneto/graphene-matrix: 8/73] cogl/tests: Compare matrices using array
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gbsneto/graphene-matrix: 8/73] cogl/tests: Compare matrices using array
- Date: Tue, 6 Oct 2020 15:34:51 +0000 (UTC)
commit 566b081cd7812e663aa09c35523a236a3c4c4445
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Sep 8 19:36:13 2020 -0300
cogl/tests: Compare matrices using array
We'll remove direct access to CoglMatrix struct fields, so update
the test to not access them already.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1439
cogl/tests/conform/test-euler.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/cogl/tests/conform/test-euler.c b/cogl/tests/conform/test-euler.c
index c911a1a137..a99576abee 100644
--- a/cogl/tests/conform/test-euler.c
+++ b/cogl/tests/conform/test-euler.c
@@ -15,24 +15,19 @@
g_assert_cmpfloat ((a), ==, (b)); \
} while (0)
+#define COMPARE_ELEMENT(a, b, idx) \
+ do { \
+ COMPARE_FLOATS (a[idx], b[idx]); \
+ } while (0)
+
#define COMPARE_MATRICES(a, b) \
do { \
- COMPARE_FLOATS ((a)->xx, (b)->xx); \
- COMPARE_FLOATS ((a)->yx, (b)->yx); \
- COMPARE_FLOATS ((a)->zx, (b)->zx); \
- COMPARE_FLOATS ((a)->wx, (b)->wx); \
- COMPARE_FLOATS ((a)->xy, (b)->xy); \
- COMPARE_FLOATS ((a)->yy, (b)->yy); \
- COMPARE_FLOATS ((a)->zy, (b)->zy); \
- COMPARE_FLOATS ((a)->wy, (b)->wy); \
- COMPARE_FLOATS ((a)->xz, (b)->xz); \
- COMPARE_FLOATS ((a)->yz, (b)->yz); \
- COMPARE_FLOATS ((a)->zz, (b)->zz); \
- COMPARE_FLOATS ((a)->wz, (b)->wz); \
- COMPARE_FLOATS ((a)->xw, (b)->xw); \
- COMPARE_FLOATS ((a)->yw, (b)->yw); \
- COMPARE_FLOATS ((a)->zw, (b)->zw); \
- COMPARE_FLOATS ((a)->ww, (b)->ww); \
+ const float *af = cogl_matrix_get_array (a);\
+ const float *bf = cogl_matrix_get_array (b);\
+ int i; \
+ \
+ for (i = 0; i < 16; i++) \
+ COMPARE_ELEMENT (af, bf, i); \
} while (0)
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]