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 1593 by tim, Mon Oct 18 21:03:15 2004 UTC vs.
Revision 1597 by tim, Tue Oct 19 04:34:35 2004 UTC

# Line 243 | Line 243 | void RectMatrixTestCase::testTranspose(){
243      CPPUNIT_ASSERT_DOUBLES_EQUAL(m1(1, 0), 3.0, oopse::epsilon);
244   }
245  
246 < void RectMatrixTestCase::testTranspose(){
246 > void RectMatrixTestCase::testRowColOperations() {
247 >    Vec3 row;
248 >    Vec3 col;
249 >    RMat3x3 m;
250 >    
251 >    //test getRow
252 >    row = e.getRow(0);
253 >    CPPUNIT_ASSERT(row[0] == 2.0 && row[1] == 4.0 && row[2] == 1.0);
254 >
255 >    //test setRow
256 >    row[0] = 2.0;    
257 >    row[1] = 4.0;    
258 >    row[2] = 1.0;    
259 >    m.setRow(0, row);
260 >    row[0] = 0.0;    
261 >    row[1] = 0.0;    
262 >    row[2] = 3.0;    
263 >    m.setRow(1, row);
264 >    row[0] = 0.0;    
265 >    row[1] = 6.0;    
266 >    row[2] = 5.0;    
267 >    m.setRow(2, row);
268 >    CPPUNIT_ASSERT(m == e);
269 >    
270 >    //test getCol
271 >    col = e.getColum(1);
272 >    CPPUNIT_ASSERT(col[0] == 4.0 && col[1] == 0.0 && col[2] == 6.0);    
273  
274 +    //test setCol
275 +    col[0] = 2.0;    
276 +    col[1] = 0.0;    
277 +    col[2] = 0.0;    
278 +    m.setColum(0, col);
279 +    col[0] = 4.0;    
280 +    col[1] = 0.0;    
281 +    col[2] = 6.0;    
282 +    m.setColum(1, col);
283 +    col[0] = 1.0;    
284 +    col[1] = 3.0;    
285 +    col[2] = 5.0;    
286 +    m.setColum(2, col);
287 +    CPPUNIT_ASSERT(m == e);
288 +
289 +    //test swapRow
290 +    RMat2x3 r;
291 +    r(0, 0) = 0.0;
292 +    r(0, 1) = 1.0;
293 +    r(0, 2) = 0.0;
294 +    r(1, 0) = 1.0;
295 +    r(1, 1) = 0.0;
296 +    r(1, 2) = 0.0;
297 +    r.swapRow(0, 1);
298 +    CPPUNIT_ASSERT(r == a);
299 +
300 +    //test swapCol
301 +    RMat3x3 s;
302 +    s(0, 0) = 4.0;
303 +    s(0, 1) = 2.0;
304 +    s(0, 2) = 1.0;
305 +    s(1, 0) = 0.0;    
306 +    s(1, 1) = 0.0;
307 +    s(1, 2) = 3.0;    
308 +    s(2, 0) = 6.0;
309 +    s(2, 1) = 0.0;
310 +    s(2, 2) = 5.0;
311 +
312 +    s.swapColum(0, 1);
313 +    CPPUNIT_ASSERT(s == e);
314 +    
315 + }    
316 +
317 + void RectMatrixTestCase::testOtherMemberFunctions(){
318 +    //test transpose
319      CPPUNIT_ASSERT((a.transpose()).transpose() == a);
320      
321      CPPUNIT_ASSERT(a.transpose() == b);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines