From dbfb53e8ef988907599241012467f7d730f1c345 Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Wed, 15 Dec 2010 15:28:43 +0100 Subject: [PATCH] Added unit test for matrix creation from const raw data. --- test/basicstuff.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 175f54009..767098341 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -195,6 +195,20 @@ void casting() } #endif +template +void fixedSizeMatrixConstruction() +{ + const Scalar raw[3] = {1,2,3}; + Matrix m(raw); + Array a(raw); + VERIFY(m(0) == 1); + VERIFY(m(1) == 2); + VERIFY(m(2) == 3); + VERIFY(a(0) == 1); + VERIFY(a(1) == 2); + VERIFY(a(2) == 3); +} + void test_basicstuff() { for(int i = 0; i < g_repeat; i++) { @@ -210,5 +224,9 @@ void test_basicstuff() CALL_SUBTEST_5( basicStuffComplex(MatrixXcd(internal::random(1,100), internal::random(1,100))) ); } + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_1(fixedSizeMatrixConstruction()); + CALL_SUBTEST_2(casting()); }