aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-05-18 13:46:46 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-05-18 13:46:46 +0200
commit345c0ab450d623b79868ea60253db9d0d8bdd5c7 (patch)
treefa96626ad10c53001afca9c4ee5bb3a3cd7ff788 /test
parente7147f69ae3282b7ae9feb80ffdcc4ae432c68e0 (diff)
check that all integer types are properly handled by mat(i,j)
Diffstat (limited to 'test')
-rw-r--r--test/indexed_view.cpp15
1 files changed, 15 insertions, 0 deletions
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()