From 345c0ab450d623b79868ea60253db9d0d8bdd5c7 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 18 May 2018 13:46:46 +0200 Subject: check that all integer types are properly handled by mat(i,j) --- test/indexed_view.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test') diff --git a/test/indexed_view.cpp b/test/indexed_view.cpp index 8b3082cea..71de60d84 100644 --- a/test/indexed_view.cpp +++ b/test/indexed_view.cpp @@ -371,6 +371,21 @@ void check_indexed_view() a(X) = 1; A(X,Y) = 1; + // Check compilation of varying integer types as index types: + Index i = n/2; + short i_short(i); + std::size_t i_sizet(i); + VERIFY_IS_EQUAL( a(i), a.coeff(i_short) ); + VERIFY_IS_EQUAL( a(i), a.coeff(i_sizet) ); + + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_short, i) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i, i_sizet) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(i_sizet, i_short) ); + VERIFY_IS_EQUAL( A(i,i), A.coeff(5, i_sizet) ); + } void test_indexed_view() -- cgit v1.2.3