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 1575 by tim, Fri Oct 15 18:17:00 2004 UTC vs.
Revision 1603 by tim, Tue Oct 19 21:28:55 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines