| 237 |
|
|
| 238 |
|
CPPUNIT_ASSERT(m1 / 2.0 * 2.0 == m1); |
| 239 |
|
|
| 240 |
+ |
|
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
void RectMatrixTestCase::testAccessEntries(){ |
| 251 |
|
|
| 252 |
|
//test getRow |
| 253 |
|
row = e.getRow(0); |
| 254 |
< |
CPPUNIT_ASSERT(row[0] == 2.0 && row[1] == 4.0 && row[2] == 1.0) |
| 255 |
< |
|
| 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; |
| 270 |
|
CPPUNIT_ASSERT(m == e); |
| 271 |
|
|
| 272 |
|
//test getCol |
| 273 |
< |
col = e.getCol(1); |
| 274 |
< |
CPPUNIT_ASSERT(col[0] == 4.0 && col[1] == 0.0 && col[2] == 6.0) |
| 275 |
< |
|
| 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.setCol(0, col); |
| 281 |
> |
m.setColum(0, col); |
| 282 |
|
col[0] = 4.0; |
| 283 |
|
col[1] = 0.0; |
| 284 |
|
col[2] = 6.0; |
| 285 |
< |
m.setCol(1, col); |
| 285 |
> |
m.setColum(1, col); |
| 286 |
|
col[0] = 1.0; |
| 287 |
|
col[1] = 3.0; |
| 288 |
|
col[2] = 5.0; |
| 289 |
< |
m.setCol(2, col); |
| 289 |
> |
m.setColum(2, col); |
| 290 |
|
CPPUNIT_ASSERT(m == e); |
| 291 |
|
|
| 292 |
|
//test swapRow |
| 312 |
|
s(2, 1) = 0.0; |
| 313 |
|
s(2, 2) = 5.0; |
| 314 |
|
|
| 315 |
< |
s.swapCol(0, 1); |
| 315 |
> |
s.swapColum(0, 1); |
| 316 |
|
CPPUNIT_ASSERT(s == e); |
| 317 |
|
|
| 318 |
|
} |