aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-12-15 15:28:43 +0100
committerGravatar Hauke Heibel <hauke.heibel@gmail.com>2010-12-15 15:28:43 +0100
commitdbfb53e8ef988907599241012467f7d730f1c345 (patch)
treec6197af46c624c96dddb003d2b7f9d132297bc34 /test
parent6f5c45ceff59b1167198755856f4cf32aa642312 (diff)
Added unit test for matrix creation from const raw data.
Diffstat (limited to 'test')
-rw-r--r--test/basicstuff.cpp18
1 files changed, 18 insertions, 0 deletions
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 <typename Scalar>
+void fixedSizeMatrixConstruction()
+{
+ const Scalar raw[3] = {1,2,3};
+ Matrix<Scalar,3,1> m(raw);
+ Array<Scalar,3,1> 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<int>(1,100), internal::random<int>(1,100))) );
}
+ CALL_SUBTEST_1(fixedSizeMatrixConstruction<unsigned char>());
+ CALL_SUBTEST_1(fixedSizeMatrixConstruction<double>());
+ CALL_SUBTEST_1(fixedSizeMatrixConstruction<double>());
+
CALL_SUBTEST_2(casting());
}