From 6e5a3b898fde197d4748315694103f577c0f503f Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 18 Jul 2018 23:34:34 +0200 Subject: Add regression for bugs #1573 and #1575 --- test/geo_quaternion.cpp | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) (limited to 'test/geo_quaternion.cpp') diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp index 3541b8b25..ed801c71b 100644 --- a/test/geo_quaternion.cpp +++ b/test/geo_quaternion.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "AnnoyingScalar.h" template T bounded_acos(T v) { @@ -85,7 +86,7 @@ template void quaternion(void) if (refangle>Scalar(EIGEN_PI)) refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle; - if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps) + if((q1.coeffs()-q2.coeffs()).norm() > Scalar(10)*largeEps) { VERIFY_IS_MUCH_SMALLER_THAN(abs(q1.angularDistance(q2) - refangle), Scalar(1)); } @@ -113,7 +114,7 @@ template void quaternion(void) // Do not execute the test if the rotation angle is almost zero, or // the rotation axis and v1 are almost parallel. - if (abs(aa.angle()) > 5*test_precision() + if (abs(aa.angle()) > Scalar(5)*test_precision() && (aa.axis() - v1.normalized()).norm() < Scalar(1.99) && (aa.axis() + v1.normalized()).norm() < Scalar(1.99)) { @@ -285,18 +286,36 @@ template void check_const_correctness(const PlainObjec VERIFY( !(Map::Flags & LvalueBit) ); } +#if EIGEN_HAS_RVALUE_REFERENCES + +// Regression for bug 1573 +struct MovableClass { + MovableClass() = default; + MovableClass(const MovableClass&) = default; + MovableClass(MovableClass&&) noexcept = default; + MovableClass& operator=(const MovableClass&) = default; + MovableClass& operator=(MovableClass&&) = default; + Quaternionf m_quat; +}; + +#endif + EIGEN_DECLARE_TEST(geo_quaternion) { for(int i = 0; i < g_repeat; i++) { CALL_SUBTEST_1(( quaternion() )); CALL_SUBTEST_1( check_const_correctness(Quaternionf()) ); + CALL_SUBTEST_1(( quaternion() )); + CALL_SUBTEST_1(( quaternionAlignment() )); + CALL_SUBTEST_1( mapQuaternion() ); + CALL_SUBTEST_2(( quaternion() )); CALL_SUBTEST_2( check_const_correctness(Quaterniond()) ); - CALL_SUBTEST_3(( quaternion() )); - CALL_SUBTEST_4(( quaternion() )); - CALL_SUBTEST_5(( quaternionAlignment() )); - CALL_SUBTEST_6(( quaternionAlignment() )); - CALL_SUBTEST_1( mapQuaternion() ); + CALL_SUBTEST_2(( quaternion() )); + CALL_SUBTEST_2(( quaternionAlignment() )); CALL_SUBTEST_2( mapQuaternion() ); + + AnnoyingScalar::dont_throw = true; + CALL_SUBTEST_3(( quaternion() )); } } -- cgit v1.2.3