stream any size of matrix
This commit is contained in:
@@ -274,6 +274,17 @@ class TemplateMatrixTest: public CppUnit::TestFixture {
|
||||
m.inv();
|
||||
CPPUNIT_ASSERT_EQUAL(m.i(), m*o);
|
||||
CPPUNIT_ASSERT_EQUAL(res, m);
|
||||
} {
|
||||
Matrix<T,3,3> m(1, 3, 1,
|
||||
1, 1, 2,
|
||||
2, 3, 4);
|
||||
const Matrix<T,3,3> res(2, 9, -5,
|
||||
0, -2, 1,
|
||||
-1, -3, 2);
|
||||
Matrix<T,3,3> o(m);
|
||||
m.inv();
|
||||
CPPUNIT_ASSERT_EQUAL(m.i(), m*o);
|
||||
CPPUNIT_ASSERT_EQUAL(res, m);
|
||||
} {
|
||||
Matrix<T,4,4> m(2, 1, 4, 1,
|
||||
-1, 1, 0, 2,
|
||||
@@ -720,6 +731,20 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
||||
CPPUNIT_ASSERT_EQUAL(res, m);
|
||||
}
|
||||
}
|
||||
template<typename T>
|
||||
void stream() {
|
||||
const Matrix<T> m1(3, 4,
|
||||
1, 2, 3, 4,
|
||||
5, 6, 7, 8,
|
||||
1, 4, 2, 8);
|
||||
Matrix<T> m2(1, 1);
|
||||
std::string res("[3x4]{1,2,3,4,5,6,7,8,1,4,2,8}");
|
||||
std::stringstream ss;
|
||||
ss<<m1;
|
||||
CPPUNIT_ASSERT_EQUAL(res, ss.str());
|
||||
ss>>m2;
|
||||
CPPUNIT_ASSERT_EQUAL(m1, m2);
|
||||
}
|
||||
CPPUNIT_TEST_SUITE(VariableMatrixTest);
|
||||
CPPUNIT_TEST(initFromArray1<int>);
|
||||
CPPUNIT_TEST(initFromArray1<long>);
|
||||
@@ -811,6 +836,12 @@ class VariableMatrixTest: public CppUnit::TestFixture {
|
||||
CPPUNIT_TEST(inv<float>);
|
||||
CPPUNIT_TEST(inv<double>);
|
||||
CPPUNIT_TEST(inv<long double>);
|
||||
CPPUNIT_TEST(stream<int>);
|
||||
CPPUNIT_TEST(stream<long>);
|
||||
CPPUNIT_TEST(stream<unsigned>);
|
||||
CPPUNIT_TEST(stream<unsigned long>);
|
||||
CPPUNIT_TEST(stream<float>);
|
||||
CPPUNIT_TEST(stream<double>);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
};
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(VariableMatrixTest);
|
||||
|
@@ -10,8 +10,7 @@
|
||||
|
||||
AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src
|
||||
AM_LDFLAGS = -L${abs_top_builddir}/src/.libs
|
||||
LDADD = -lcppunit
|
||||
#LDADD = -lmatricxx
|
||||
LDADD = -lcppunit -lmatricxx
|
||||
|
||||
check_PROGRAMS = basic
|
||||
TESTS = ${check_PROGRAMS}
|
||||
|
Reference in New Issue
Block a user