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

Comparing trunk/OOPSE-3.0/test/math/Vector3TestCase.cpp (file contents):
Revision 1594 by tim, Mon Oct 18 21:03:15 2004 UTC vs.
Revision 1595 by tim, Tue Oct 19 04:21:07 2004 UTC

# Line 5 | Line 5 | void Vector3TestCase::setUp(){
5  
6  
7   void Vector3TestCase::setUp(){
8 +    zero[0] = 0.0;
9 +    zero[1] = 0.0;
10 +    zero[2] = 0.0;
11 +
12 +    one[0] = 1.0;
13 +    one[1] = 1.0;
14 +    one[2] = 1.0;
15 +
16 +    two[0] = 2.0;
17 +    two[1] = 2.0;
18 +    two[2] = 2.0;
19 +
20 +    v1[0] = 1.0;
21 +    v1[1] = 2.0;
22 +    v1[2] = 3.0;
23 +
24 +    v2[0] = 4.0;
25 +    v2[1] = 1.0;
26 +    v2[2] = 2.0;
27 +
28 +    v3[0] = 1.0;
29 +    v3[1] = 10.0;
30 +    v3[2] = -7.0;
31 +
32 +    
33   }
34  
35   void Vector3TestCase::tearDown(){
# Line 14 | Line 39 | void Vector3TestCase::testArithmetic(){
39   }
40  
41   void Vector3TestCase::testArithmetic(){
42 +
43 +    
44   }
45  
46   void Vector3TestCase::testOperators(){
47 +    Vector3d tmp;
48 +    //test +=
49 +
50 +    //test +
51 +    CPPUNIT_ASSERT(one + one == two);
52 +    
53 +    //test -=
54 +    tmp = two;
55 +    tmp -= one;
56 +    CPPUNIT_ASSERT(tmp == one);
57 +    
58 +    //test -
59 +    CPPUNIT_ASSERT(two -one == one);
60 +    
61 +    //test *=
62 +    tmp = two;
63 +    tmp *= 0.5;
64 +    CPPUNIT_ASSERT(tmp == one);
65 +    
66 +    //test *
67 +    CPPUNIT_ASSERT(two * 0.5 == one);
68 +    CPPUNIT_ASSERT(0.5 * two == one);
69 +
70 +    //test /=
71 +    tmp = two;
72 +    tmp *= 2.0;
73 +    CPPUNIT_ASSERT(tmp == one);    
74 +    //test /
75 +    CPPUNIT_ASSERT( two /2 == one);
76 +    CPPUNIT_ASSERT( two /4 == one * 0.5);
77 +    
78   }
79  
80   void Vector3TestCase::testAccessEntries(){
23 }
81  
82 < void Vector3TestCase::testOtherTemplateFunctions(){        
82 >    CPPUNIT_ASSERT(v1.z() == 3.0);
83 >    CPPUNIT_ASSERT(v2.x() == 4.0);
84 >    CPPUNIT_ASSERT(v3.y() == 10.0);
85  
86 < }
86 >    Vector3d tmp;
87 >    tmp.x() = 78.01;
88 >    tmp.y() = 21.0;
89 >    tmp.z() =133.12;
90 >    CPPUNIT_ASSERT(tmp[0] == 78.01 && tmp[1] == 21.0 && tmp[2] == 133.12);
91 >    
92 > }
93 >
94 > void Vector3TestCase::testOtherTemplateFunctions(){      
95 >    //test cross
96 >    CPPUNIT_ASSERT(cross(v1, v2) == v3);
97 >    CPPUNIT_ASSERT(cross(one, two) == zero);
98 >    
99 > }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines