Add DSizes index type promotion

This commit is contained in:
Eugene Zhulenev
2018-09-15 15:17:38 -07:00
parent 42705ba574
commit 66f056776f
2 changed files with 36 additions and 1 deletions

View File

@@ -60,10 +60,28 @@ static void test_rank_zero()
VERIFY_IS_EQUAL((int)dscalar.rank(), 0);
}
static void test_index_type_promotion() {
#ifdef EIGEN_HAS_CXX11
Eigen::DSizes<int, 3> src0(1, 2, 3);
Eigen::array<int, 3> src1 = {4, 5, 6};
Eigen::DSizes<long, 3> dst0(src0);
Eigen::DSizes<long, 3> dst1(src1);
VERIFY_IS_EQUAL(dst0[0], 1L);
VERIFY_IS_EQUAL(dst0[1], 2L);
VERIFY_IS_EQUAL(dst0[2], 3L);
VERIFY_IS_EQUAL(dst1[0], 4L);
VERIFY_IS_EQUAL(dst1[1], 5L);
VERIFY_IS_EQUAL(dst1[2], 6L);
#endif // EIGEN_HAS_CXX11
}
EIGEN_DECLARE_TEST(cxx11_tensor_dimension)
{
CALL_SUBTEST(test_dynamic_size());
CALL_SUBTEST(test_fixed_size());
CALL_SUBTEST(test_match());
CALL_SUBTEST(test_rank_zero());
CALL_SUBTEST(test_index_type_promotion());
}