aboutsummaryrefslogtreecommitdiff
path: root/unsupported/test/alignedvector3.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unsupported/test/alignedvector3.cpp')
-rw-r--r--unsupported/test/alignedvector3.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/unsupported/test/alignedvector3.cpp b/unsupported/test/alignedvector3.cpp
index fc2bc2135..252cb1d3f 100644
--- a/unsupported/test/alignedvector3.cpp
+++ b/unsupported/test/alignedvector3.cpp
@@ -10,6 +10,16 @@
#include "main.h"
#include <unsupported/Eigen/AlignedVector3>
+namespace Eigen {
+
+template<typename T,typename Derived>
+T test_relative_error(const AlignedVector3<T> &a, const MatrixBase<Derived> &b)
+{
+ return test_relative_error(a.coeffs().template head<3>(), b);
+}
+
+}
+
template<typename Scalar>
void alignedvector3()
{
@@ -19,8 +29,8 @@ void alignedvector3()
typedef Matrix<Scalar,3,3> Mat33;
typedef AlignedVector3<Scalar> FastType;
RefType r1(RefType::Random()), r2(RefType::Random()), r3(RefType::Random()),
- r4(RefType::Random()), r5(RefType::Random()), r6(RefType::Random());
- FastType f1(r1), f2(r2), f3(r3), f4(r4), f5(r5), f6(r6);
+ r4(RefType::Random()), r5(RefType::Random());
+ FastType f1(r1), f2(r2), f3(r3), f4(r4), f5(r5);
Mat33 m1(Mat33::Random());
VERIFY_IS_APPROX(f1,r1);
@@ -49,6 +59,21 @@ void alignedvector3()
f2.normalize();
r2.normalize();
VERIFY_IS_APPROX(f2,r2);
+
+ {
+ FastType f6 = RefType::Zero();
+ FastType f7 = FastType::Zero();
+ VERIFY_IS_APPROX(f6,f7);
+ f6 = r4+r1;
+ VERIFY_IS_APPROX(f6,r4+r1);
+ f6 -= Scalar(2)*r4;
+ VERIFY_IS_APPROX(f6,r1-r4);
+ }
+
+ std::stringstream ss1, ss2;
+ ss1 << f1;
+ ss2 << r1;
+ VERIFY(ss1.str()==ss2.str());
}
void test_alignedvector3()