From 972a535288c5aaa62b66d43e1825e3b4eed7d234 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 14 Jun 2015 15:04:07 +0200 Subject: Remove aligned-on-scalar assert and fallback to non vectorized path at runtime (first_aligned already had this runtime guard) --- test/mapped_matrix.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/mapped_matrix.cpp') 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 void check_const_correctness(const PlainObjec VERIFY( !(Map::Flags & LvalueBit) ); } +template +void map_not_aligned_on_scalar() +{ + typedef Matrix MatrixType; + typedef typename MatrixType::Index Index; + Index size = 11; + Scalar* array1 = internal::aligned_new((size+1)*(size+1)+1); + Scalar* array2 = reinterpret_cast(sizeof(Scalar)/2+std::size_t(array1)); + Map > map2(array2, size, size, OuterStride<>(size+1)); + MatrixType m2 = MatrixType::Random(size,size); + map2 = m2; + VERIFY_IS_EQUAL(m2, map2); + + typedef Matrix VectorType; + Map 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() ); } } -- cgit v1.2.3