Added unit test for matrix creation from const raw data.

This commit is contained in:
Hauke Heibel 2010-12-15 15:28:43 +01:00
parent 6f5c45ceff
commit dbfb53e8ef

View File

@ -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());
}