Skip to content

Commit 6e5a3b8

Browse files
committed
Add regression for bugs #1573 and #1575
1 parent 863580f commit 6e5a3b8

File tree

1 file changed

+26
-7
lines changed

1 file changed

+26
-7
lines changed

test/geo_quaternion.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <Eigen/Geometry>
1313
#include <Eigen/LU>
1414
#include <Eigen/SVD>
15+
#include "AnnoyingScalar.h"
1516

1617
template<typename T> T bounded_acos(T v)
1718
{
@@ -85,7 +86,7 @@ template<typename Scalar, int Options> void quaternion(void)
8586
if (refangle>Scalar(EIGEN_PI))
8687
refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle;
8788

88-
if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps)
89+
if((q1.coeffs()-q2.coeffs()).norm() > Scalar(10)*largeEps)
8990
{
9091
VERIFY_IS_MUCH_SMALLER_THAN(abs(q1.angularDistance(q2) - refangle), Scalar(1));
9192
}
@@ -113,7 +114,7 @@ template<typename Scalar, int Options> void quaternion(void)
113114

114115
// Do not execute the test if the rotation angle is almost zero, or
115116
// the rotation axis and v1 are almost parallel.
116-
if (abs(aa.angle()) > 5*test_precision<Scalar>()
117+
if (abs(aa.angle()) > Scalar(5)*test_precision<Scalar>()
117118
&& (aa.axis() - v1.normalized()).norm() < Scalar(1.99)
118119
&& (aa.axis() + v1.normalized()).norm() < Scalar(1.99))
119120
{
@@ -285,18 +286,36 @@ template<typename PlainObjectType> void check_const_correctness(const PlainObjec
285286
VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );
286287
}
287288

289+
#if EIGEN_HAS_RVALUE_REFERENCES
290+
291+
// Regression for bug 1573
292+
struct MovableClass {
293+
MovableClass() = default;
294+
MovableClass(const MovableClass&) = default;
295+
MovableClass(MovableClass&&) noexcept = default;
296+
MovableClass& operator=(const MovableClass&) = default;
297+
MovableClass& operator=(MovableClass&&) = default;
298+
Quaternionf m_quat;
299+
};
300+
301+
#endif
302+
288303
EIGEN_DECLARE_TEST(geo_quaternion)
289304
{
290305
for(int i = 0; i < g_repeat; i++) {
291306
CALL_SUBTEST_1(( quaternion<float,AutoAlign>() ));
292307
CALL_SUBTEST_1( check_const_correctness(Quaternionf()) );
308+
CALL_SUBTEST_1(( quaternion<float,DontAlign>() ));
309+
CALL_SUBTEST_1(( quaternionAlignment<float>() ));
310+
CALL_SUBTEST_1( mapQuaternion<float>() );
311+
293312
CALL_SUBTEST_2(( quaternion<double,AutoAlign>() ));
294313
CALL_SUBTEST_2( check_const_correctness(Quaterniond()) );
295-
CALL_SUBTEST_3(( quaternion<float,DontAlign>() ));
296-
CALL_SUBTEST_4(( quaternion<double,DontAlign>() ));
297-
CALL_SUBTEST_5(( quaternionAlignment<float>() ));
298-
CALL_SUBTEST_6(( quaternionAlignment<double>() ));
299-
CALL_SUBTEST_1( mapQuaternion<float>() );
314+
CALL_SUBTEST_2(( quaternion<double,DontAlign>() ));
315+
CALL_SUBTEST_2(( quaternionAlignment<double>() ));
300316
CALL_SUBTEST_2( mapQuaternion<double>() );
317+
318+
AnnoyingScalar::dont_throw = true;
319+
CALL_SUBTEST_3(( quaternion<AnnoyingScalar,AutoAlign>() ));
301320
}
302321
}

0 commit comments

Comments
 (0)