Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@stuvel.eu>2017-04-05 18:03:59 +0300
committerSybren A. Stüvel <sybren@stuvel.eu>2017-04-06 17:47:01 +0300
commitb6775cd6849d6f9cc3355ed2be7fa9d6cfe64a25 (patch)
tree8ea83f7d56f023016284069618ce174925e5545d /tests/gtests
parentc2fec0f1b007920935aaf11ee6969fe6d0cfa528 (diff)
Added float[][] comparison macros to testing.h
I've moved EXPECT_M3_NEAR from abc_matrix_test.cc to testing.h, as that's a more suitable location.
Diffstat (limited to 'tests/gtests')
-rw-r--r--tests/gtests/alembic/abc_matrix_test.cc6
-rw-r--r--tests/gtests/testing/testing.h23
2 files changed, 23 insertions, 6 deletions
diff --git a/tests/gtests/alembic/abc_matrix_test.cc b/tests/gtests/alembic/abc_matrix_test.cc
index bbdcd467de9..c9a79a73f60 100644
--- a/tests/gtests/alembic/abc_matrix_test.cc
+++ b/tests/gtests/alembic/abc_matrix_test.cc
@@ -9,12 +9,6 @@ extern "C" {
}
-#define EXPECT_M3_NEAR(a, b, eps) {\
- EXPECT_V3_NEAR(a[0], b[0], eps); \
- EXPECT_V3_NEAR(a[1], b[1], eps); \
- EXPECT_V3_NEAR(a[2], b[2], eps); \
-}
-
TEST(abc_matrix, CreateRotationMatrixY_YfromZ) {
// Input variables
float rot_x_mat[3][3];
diff --git a/tests/gtests/testing/testing.h b/tests/gtests/testing/testing.h
index 1594ed3926c..d5a7b076970 100644
--- a/tests/gtests/testing/testing.h
+++ b/tests/gtests/testing/testing.h
@@ -12,6 +12,29 @@
EXPECT_NEAR(a[2], b[2], eps); \
} (void) 0
+#define EXPECT_V4_NEAR(a, b, eps) \
+{ \
+ EXPECT_NEAR(a[0], b[0], eps); \
+ EXPECT_NEAR(a[1], b[1], eps); \
+ EXPECT_NEAR(a[2], b[2], eps); \
+ EXPECT_NEAR(a[3], b[3], eps); \
+ } (void) 0
+
+#define EXPECT_M3_NEAR(a, b, eps) \
+do { \
+ EXPECT_V3_NEAR(a[0], b[0], eps); \
+ EXPECT_V3_NEAR(a[1], b[1], eps); \
+ EXPECT_V3_NEAR(a[2], b[2], eps); \
+} while(false);
+
+#define EXPECT_M4_NEAR(a, b, eps) \
+do { \
+ EXPECT_V3_NEAR(a[0], b[0], eps); \
+ EXPECT_V3_NEAR(a[1], b[1], eps); \
+ EXPECT_V3_NEAR(a[2], b[2], eps); \
+ EXPECT_V4_NEAR(a[3], b[3], eps); \
+} while(false);
+
#define EXPECT_MATRIX_NEAR(a, b, tolerance) \
do { \
bool dims_match = (a.rows() == b.rows()) && (a.cols() == b.cols()); \