From dff3a92d527fd38c28152ab9259af1904a01f248 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 17 Jul 2018 15:52:58 +0200 Subject: Remove usage of #if EIGEN_TEST_PART_XX in unit tests that does not require them (splitting can thus be avoided for them) --- test/product_small.cpp | 58 +++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 27 deletions(-) (limited to 'test/product_small.cpp') diff --git a/test/product_small.cpp b/test/product_small.cpp index 16138631a..b8ce37d90 100644 --- a/test/product_small.cpp +++ b/test/product_small.cpp @@ -228,6 +228,36 @@ void bug_1311() VERIFY_IS_APPROX(res, A*b); } +template +void product_small_regressions() +{ + { + // test compilation of (outer_product) * vector + Vector3f v = Vector3f::Random(); + VERIFY_IS_APPROX( (v * v.transpose()) * v, (v * v.transpose()).eval() * v); + } + + { + // regression test for pull-request #93 + Eigen::Matrix A; A.setRandom(); + Eigen::Matrix B; B.setRandom(); + Eigen::Matrix C; C.setRandom(); + VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]); + VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C); + } + + { + Eigen::Matrix A, B, C; + A.setRandom(); + C = A; + for(int k=0; k<79; ++k) + C = C * A; + B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))) + * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))); + VERIFY_IS_APPROX(B,C); + } +} + EIGEN_DECLARE_TEST(product_small) { for(int i = 0; i < g_repeat; i++) { @@ -263,31 +293,5 @@ EIGEN_DECLARE_TEST(product_small) CALL_SUBTEST_6( bug_1311<5>() ); } -#ifdef EIGEN_TEST_PART_6 - { - // test compilation of (outer_product) * vector - Vector3f v = Vector3f::Random(); - VERIFY_IS_APPROX( (v * v.transpose()) * v, (v * v.transpose()).eval() * v); - } - - { - // regression test for pull-request #93 - Eigen::Matrix A; A.setRandom(); - Eigen::Matrix B; B.setRandom(); - Eigen::Matrix C; C.setRandom(); - VERIFY_IS_APPROX(B * A.inverse(), B * A.inverse()[0]); - VERIFY_IS_APPROX(A.inverse() * C, A.inverse()[0] * C); - } - - { - Eigen::Matrix A, B, C; - A.setRandom(); - C = A; - for(int k=0; k<79; ++k) - C = C * A; - B.noalias() = (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))) - * (((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A)) * ((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))*((A*A)*(A*A))); - VERIFY_IS_APPROX(B,C); - } -#endif + CALL_SUBTEST_6( product_small_regressions<0>() ); } -- cgit v1.2.3