--- trunk/OOPSE-3.0/test/math/RectMatrixTestCase.cpp 2004/10/19 21:28:55 1603 +++ trunk/OOPSE-3.0/test/math/RectMatrixTestCase.cpp 2004/12/01 19:10:51 1816 @@ -166,6 +166,15 @@ void RectMatrixTestCase::testConstructor(){ tmp4 = tmp4; CPPUNIT_ASSERT(tmp4 == m2); + double tmp5[4]; + tmp5[0] = 1.0; + tmp5[1] = 1.0; + tmp5[2] = 3.0; + tmp5[3] = 1.0; + + RMat2x2 tmp6(tmp5); + CPPUNIT_ASSERT(tmp6 == m1); + } @@ -270,7 +279,7 @@ void RectMatrixTestCase::testRowColOperations() { CPPUNIT_ASSERT(m == e); //test getCol - col = e.getColum(1); + col = e.getColumn(1); CPPUNIT_ASSERT_DOUBLES_EQUAL(col[0], 4.0, oopse::epsilon); CPPUNIT_ASSERT_DOUBLES_EQUAL(col[1], 0.0, oopse::epsilon); CPPUNIT_ASSERT_DOUBLES_EQUAL(col[2], 6.0, oopse::epsilon); @@ -278,15 +287,15 @@ void RectMatrixTestCase::testRowColOperations() { col[0] = 2.0; col[1] = 0.0; col[2] = 0.0; - m.setColum(0, col); + m.setColumn(0, col); col[0] = 4.0; col[1] = 0.0; col[2] = 6.0; - m.setColum(1, col); + m.setColumn(1, col); col[0] = 1.0; col[1] = 3.0; col[2] = 5.0; - m.setColum(2, col); + m.setColumn(2, col); CPPUNIT_ASSERT(m == e); //test swapRow @@ -312,9 +321,22 @@ void RectMatrixTestCase::testRowColOperations() { s(2, 1) = 0.0; s(2, 2) = 5.0; - s.swapColum(0, 1); + s.swapColumn(0, 1); CPPUNIT_ASSERT(s == e); - + + double* p = s.getArrayPointer(); + + p[0] = 2.0; + p[1] = 4.0; + p[2] = 1.0; + p[3] = 0.0; + p[4] = 6.0; + p[5] = 5.0; + p[6] = 0.0; + p[7] = 0.0; + p[8] = 3.0; + + CPPUNIT_ASSERT(s == f); } void RectMatrixTestCase::testOtherMemberFunctions(){ @@ -322,4 +344,14 @@ void RectMatrixTestCase::testOtherMemberFunctions(){ CPPUNIT_ASSERT((a.transpose()).transpose() == a); CPPUNIT_ASSERT(a.transpose() == b); + + //test getArray + + double tmp[4]; + m4.getArray(tmp); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[0], -1.0, oopse::epsilon); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[1], -1.0, oopse::epsilon); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[2], -3.0, oopse::epsilon); + CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[3], -1.0, oopse::epsilon); + }