1 |
#include "SquareMatrixTestCase.hpp" |
2 |
|
3 |
// Registers the fixture into the 'registry' |
4 |
CPPUNIT_TEST_SUITE_REGISTRATION( SquareMatrixTestCase ); |
5 |
|
6 |
void SquareMatrixTestCase::setUp() { |
7 |
|
8 |
identMat(0, 0) = 1.0; |
9 |
identMat(0, 1) = 0.0; |
10 |
identMat(0, 2) = 0.0; |
11 |
identMat(1, 0) = 0.0; |
12 |
identMat(1, 1) = 1.0; |
13 |
identMat(1, 2) = 0.0; |
14 |
identMat(2, 0) = 0.0; |
15 |
identMat(2, 1) = 0.0; |
16 |
identMat(2, 2) = 1.0; |
17 |
|
18 |
symMat(0, 0) = 2.0; |
19 |
symMat(0, 1) = 4.0; |
20 |
symMat(0, 2) = 0.5; |
21 |
symMat(1, 0) = 4.0; |
22 |
symMat(1, 1) = 1.0; |
23 |
symMat(1, 2) = 3.0; |
24 |
symMat(2, 0) = 0.5; |
25 |
symMat(2, 1) = 3.0; |
26 |
symMat(2, 2) = 1.0; |
27 |
|
28 |
ortMat(0, 0) = 1.0; |
29 |
ortMat(0, 1) = 0.0; |
30 |
ortMat(0, 2) = 0.0; |
31 |
ortMat(1, 0) = 0.0; |
32 |
ortMat(1, 1) = cos(0.5); |
33 |
ortMat(1, 2) = -sin(0.5); |
34 |
ortMat(2, 0) = 0.0; |
35 |
ortMat(2, 1) = sin(0.5); |
36 |
ortMat(2, 2) = cos(0.5); |
37 |
|
38 |
diagMat(0, 0) = 8.0; |
39 |
diagMat(0, 1) = 0.0; |
40 |
diagMat(0, 2) = 0.0; |
41 |
diagMat(1, 0) = 0.0; |
42 |
diagMat(1, 1) = 1.0; |
43 |
diagMat(1, 2) = 0.0; |
44 |
diagMat(2, 0) = 0.0; |
45 |
diagMat(2, 1) = 0.0; |
46 |
diagMat(2, 2) = 3.0; |
47 |
|
48 |
} |
49 |
|
50 |
void SquareMatrixTestCase::testConstructor() { |
51 |
|
52 |
} |
53 |
|
54 |
void SquareMatrixTestCase::testIdentity() { |
55 |
CPPUNIT_ASSERT(SMat3x3::identity() == identMat); |
56 |
} |
57 |
|
58 |
void SquareMatrixTestCase::testInverse() { |
59 |
|
60 |
} |
61 |
|
62 |
void SquareMatrixTestCase::testDeterminant() { |
63 |
|
64 |
} |
65 |
|
66 |
void SquareMatrixTestCase::testTrace() { |
67 |
CPPUNIT_ASSERT_DOUBLES_EQUAL(identMat.trace(), 3.0, oopse::epsilon); |
68 |
CPPUNIT_ASSERT_DOUBLES_EQUAL(symMat.trace(), 4.0, oopse::epsilon); |
69 |
} |
70 |
void SquareMatrixTestCase::testIsSymmertric(){ |
71 |
CPPUNIT_ASSERT(identMat.isSymmetric()); |
72 |
CPPUNIT_ASSERT(symMat.isSymmetric()); |
73 |
} |
74 |
|
75 |
void SquareMatrixTestCase::testIsOrthogonal(){ |
76 |
CPPUNIT_ASSERT(ortMat.isOrthogonal()); |
77 |
} |
78 |
|
79 |
void SquareMatrixTestCase::testIsDiagonal() { |
80 |
CPPUNIT_ASSERT(identMat.isDiagonal()); |
81 |
CPPUNIT_ASSERT(diagMat.isDiagonal()); |
82 |
CPPUNIT_ASSERT(!symMat.isDiagonal()); |
83 |
} |
84 |
void SquareMatrixTestCase::testIsUnitMatrix() { |
85 |
CPPUNIT_ASSERT(identMat.isUnitMatrix()); |
86 |
CPPUNIT_ASSERT(!symMat.isUnitMatrix()); |
87 |
} |