diff options
Diffstat (limited to 'test/mapped_matrix.cpp')
-rw-r--r-- | test/mapped_matrix.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp index 05a86e70b..1f9da31ac 100644 --- a/test/mapped_matrix.cpp +++ b/test/mapped_matrix.cpp @@ -159,6 +159,28 @@ template<typename PlainObjectType> void check_const_correctness(const PlainObjec VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) ); } +template<typename Scalar> +void map_not_aligned_on_scalar() +{ + typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType; + typedef typename MatrixType::Index Index; + Index size = 11; + Scalar* array1 = internal::aligned_new<Scalar>((size+1)*(size+1)+1); + Scalar* array2 = reinterpret_cast<Scalar*>(sizeof(Scalar)/2+std::size_t(array1)); + Map<MatrixType,0,OuterStride<> > map2(array2, size, size, OuterStride<>(size+1)); + MatrixType m2 = MatrixType::Random(size,size); + map2 = m2; + VERIFY_IS_EQUAL(m2, map2); + + typedef Matrix<Scalar,Dynamic,1> VectorType; + Map<VectorType> map3(array2, size); + MatrixType v3 = VectorType::Random(size); + map3 = v3; + VERIFY_IS_EQUAL(v3, map3); + + internal::aligned_delete(array1, (size+1)*(size+1)+1); +} + void test_mapped_matrix() { for(int i = 0; i < g_repeat; i++) { @@ -183,5 +205,7 @@ void test_mapped_matrix() CALL_SUBTEST_8( map_static_methods(RowVector3d()) ); CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) ); CALL_SUBTEST_10( map_static_methods(VectorXf(12)) ); + + CALL_SUBTEST_11( map_not_aligned_on_scalar<double>() ); } } |