diff options
author | Gael Guennebaud <g.gael@free.fr> | 2018-07-17 15:52:58 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2018-07-17 15:52:58 +0200 |
commit | dff3a92d527fd38c28152ab9259af1904a01f248 (patch) | |
tree | 6184304dd437e20e4d7ad3481b27e3a2e9be3fb0 /test/product_small.cpp | |
parent | 82f0ce27261df3b21037d93d4595655b3df754a6 (diff) |
Remove usage of #if EIGEN_TEST_PART_XX in unit tests that does not require them (splitting can thus be avoided for them)
Diffstat (limited to 'test/product_small.cpp')
-rw-r--r-- | test/product_small.cpp | 58 |
1 files changed, 31 insertions, 27 deletions
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<int> +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<double, 1, 1> A; A.setRandom(); + Eigen::Matrix<double, 18, 1> B; B.setRandom(); + Eigen::Matrix<double, 1, 18> 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<double, 10, 10> 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<double, 1, 1> A; A.setRandom(); - Eigen::Matrix<double, 18, 1> B; B.setRandom(); - Eigen::Matrix<double, 1, 18> 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<double, 10, 10> 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>() ); } |