diff options
Diffstat (limited to 'test/commainitializer.cpp')
-rw-r--r-- | test/commainitializer.cpp | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/test/commainitializer.cpp b/test/commainitializer.cpp index 9844adbd2..eb275be9c 100644 --- a/test/commainitializer.cpp +++ b/test/commainitializer.cpp @@ -34,8 +34,14 @@ void test_blocks() if(N1 > 0) { - VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat11, mat21, mat22)); - VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat21, mat21, mat22)); + if(M1 > 0) + { + VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat11, mat21, mat22)); + } + if(M2 > 0) + { + VERIFY_RAISES_ASSERT((m_fixed << mat11, mat12, mat21, mat21, mat22)); + } } else { @@ -49,24 +55,25 @@ void test_blocks() } -template<int N> +template<int depth, int N=0> struct test_block_recursion { static void run() { - test_blocks<(N>>6)&3, (N>>4)&3, (N>>2)&3, N & 3>(); - test_block_recursion<N-1>::run(); + test_block_recursion<depth-1, N>::run(); + test_block_recursion<depth-1, N + (1 << (depth-1))>::run(); } }; -template<> -struct test_block_recursion<-1> +template<int N> +struct test_block_recursion<0,N> { - static void run() { } + static void run() { + test_blocks<(N>>6)&3, (N>>4)&3, (N>>2)&3, N & 3>(); + } }; -void test_commainitializer() -{ +void test_basics() { Matrix3d m3; Matrix4d m4; @@ -99,8 +106,13 @@ void test_commainitializer() 4, 5, 6, vec[2].transpose(); VERIFY_IS_APPROX(m3, ref); +} + +EIGEN_DECLARE_TEST(commainitializer) +{ + CALL_SUBTEST_1(test_basics()); // recursively test all block-sizes from 0 to 3: - test_block_recursion<(1<<8) - 1>(); + CALL_SUBTEST_2(test_block_recursion<8>::run()); } |