Added float[][] comparison macros to testing.h
authorSybren A. Stüvel <sybren@stuvel.eu>
Wed, 5 Apr 2017 15:03:59 +0000 (17:03 +0200)
committerSybren A. Stüvel <sybren@stuvel.eu>
Thu, 6 Apr 2017 14:47:01 +0000 (16:47 +0200)
I've moved EXPECT_M3_NEAR from abc_matrix_test.cc to testing.h, as that's
a more suitable location.

tests/gtests/alembic/abc_matrix_test.cc
tests/gtests/testing/testing.h

index bbdcd467de9f4a3f47c5b8f1f4ffc86a0f95110f..c9a79a73f60971a5d1defe128fdaaf7456c5cf78 100644 (file)
@@ -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];
index 1594ed3926c9b45d0efe458ed39c1b82b51e0c99..d5a7b07697082ee94b7de815386c1b5de00b1f88 100644 (file)
     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()); \