[Bf-blender-cvs] [b6775cd6849] master: Added float[][] comparison macros to testing.h
Sybren A. Stüvel
noreply at git.blender.org
Thu Apr 6 16:52:31 CEST 2017
Commit: b6775cd6849d6f9cc3355ed2be7fa9d6cfe64a25
Author: Sybren A. Stüvel
Date: Wed Apr 5 17:03:59 2017 +0200
Branches: master
https://developer.blender.org/rBb6775cd6849d6f9cc3355ed2be7fa9d6cfe64a25
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.
===================================================================
M tests/gtests/alembic/abc_matrix_test.cc
M tests/gtests/testing/testing.h
===================================================================
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()); \
More information about the Bf-blender-cvs
mailing list