ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-3.0/test/math/RectMatrixTestCase.cpp
(Generate patch)

Comparing trunk/OOPSE-3.0/test/math/RectMatrixTestCase.cpp (file contents):
Revision 1597 by tim, Tue Oct 19 04:34:35 2004 UTC vs.
Revision 1644 by tim, Mon Oct 25 22:46:19 2004 UTC

# Line 166 | Line 166 | void RectMatrixTestCase::testConstructor(){
166      tmp4 = tmp4;
167      CPPUNIT_ASSERT(tmp4 == m2);
168      
169 +    double tmp5[4];
170 +    tmp5[0] = 1.0;
171 +    tmp5[1] = 1.0;
172 +    tmp5[2] = 3.0;
173 +    tmp5[3] = 1.0;
174 +
175 +    RMat2x2 tmp6(tmp5);
176 +    CPPUNIT_ASSERT(tmp6 == m1);
177 +  
178      
179   }
180  
# Line 237 | Line 246 | void RectMatrixTestCase::testDiv() {
246  
247      CPPUNIT_ASSERT(m1 / 2.0 * 2.0 == m1);
248  
249 +
250   }
251  
252   void RectMatrixTestCase::testAccessEntries(){
# Line 250 | Line 260 | void RectMatrixTestCase::testRowColOperations() {
260      
261      //test getRow
262      row = e.getRow(0);
263 <    CPPUNIT_ASSERT(row[0] == 2.0 && row[1] == 4.0 && row[2] == 1.0);
264 <
263 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(row[0], 2.0, oopse::epsilon);
264 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(row[1], 4.0, oopse::epsilon);
265 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(row[2], 1.0, oopse::epsilon);
266      //test setRow
267      row[0] = 2.0;    
268      row[1] = 4.0;    
# Line 269 | Line 280 | void RectMatrixTestCase::testRowColOperations() {
280      
281      //test getCol
282      col = e.getColum(1);
283 <    CPPUNIT_ASSERT(col[0] == 4.0 && col[1] == 0.0 && col[2] == 6.0);    
284 <
283 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(col[0], 4.0, oopse::epsilon);    
284 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(col[1], 0.0, oopse::epsilon);
285 >    CPPUNIT_ASSERT_DOUBLES_EQUAL(col[2], 6.0, oopse::epsilon);
286      //test setCol
287      col[0] = 2.0;    
288      col[1] = 0.0;    
# Line 311 | Line 323 | void RectMatrixTestCase::testRowColOperations() {
323  
324      s.swapColum(0, 1);
325      CPPUNIT_ASSERT(s == e);
326 <    
326 >
327 >    double* p = s.getArrayPointer();
328 >
329 >    p[0] = 2.0;
330 >    p[1] = 4.0;
331 >    p[2] = 1.0;
332 >    p[3] = 0.0;
333 >    p[4] = 6.0;
334 >    p[5] = 5.0;    
335 >    p[6] = 0.0;
336 >    p[7] = 0.0;
337 >    p[8] = 3.0;  
338 >
339 >    CPPUNIT_ASSERT(s == f);    
340   }    
341  
342   void RectMatrixTestCase::testOtherMemberFunctions(){
# Line 319 | Line 344 | void RectMatrixTestCase::testOtherMemberFunctions(){
344      CPPUNIT_ASSERT((a.transpose()).transpose() == a);
345      
346      CPPUNIT_ASSERT(a.transpose() == b);
347 +
348 +    //test getArray
349 +
350 +    double tmp[4];
351 +    m4.getArray(tmp);
352 +    CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[0], -1.0, oopse::epsilon);    
353 +    CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[1], -1.0, oopse::epsilon);
354 +    CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[2], -3.0, oopse::epsilon);    
355 +    CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp[3], -1.0, oopse::epsilon);    
356 +    
357   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines