# | Line 36 | Line 36 | void Vector3TestCase::testConstructors(){ | |
---|---|---|
36 | } | |
37 | ||
38 | void Vector3TestCase::testConstructors(){ | |
39 | + | double b[] = {2.9, 3.2, 1.2}; |
40 | + | Vector3d v(b); |
41 | + | CPPUNIT_ASSERT_DOUBLES_EQUAL(v.x(), 2.9, OpenMD::NumericConstant::epsilon); |
42 | + | CPPUNIT_ASSERT_DOUBLES_EQUAL(v.y(), 3.2, OpenMD::NumericConstant::epsilon); |
43 | + | CPPUNIT_ASSERT_DOUBLES_EQUAL(v.z(), 1.2, OpenMD::NumericConstant::epsilon); |
44 | } | |
45 | ||
46 | void Vector3TestCase::testArithmetic(){ | |
# | Line 70 | Line 75 | void Vector3TestCase::testOperators(){ | |
75 | //test /= | |
76 | tmp = two; | |
77 | tmp *= 2.0; | |
78 | < | CPPUNIT_ASSERT(tmp == one); |
74 | < | //test / |
75 | < | CPPUNIT_ASSERT( two /2 == one); |
76 | < | CPPUNIT_ASSERT( two /4 == one * 0.5); |
78 | > | CPPUNIT_ASSERT(tmp == one * 4.0); |
79 | ||
80 | + | //test / |
81 | + | CPPUNIT_ASSERT( two /2.0 == one); |
82 | + | CPPUNIT_ASSERT( two /4.0 == one * 0.5); |
83 | + | |
84 | } | |
85 | ||
86 | void Vector3TestCase::testAccessEntries(){ | |
87 | ||
88 | < | CPPUNIT_ASSERT(v1.z() == 3.0); |
89 | < | CPPUNIT_ASSERT(v2.x() == 4.0); |
90 | < | CPPUNIT_ASSERT(v3.y() == 10.0); |
88 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(v1.z(), 3.0, OpenMD::NumericConstant::epsilon); |
89 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(v2.x(), 4.0, OpenMD::NumericConstant::epsilon); |
90 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(v3.y(), 10.0, OpenMD::NumericConstant::epsilon); |
91 | ||
92 | Vector3d tmp; | |
93 | tmp.x() = 78.01; | |
94 | tmp.y() = 21.0; | |
95 | tmp.z() =133.12; | |
96 | < | CPPUNIT_ASSERT(tmp[0] == 78.01 && tmp[1] == 21.0 && tmp[2] == 133.12); |
97 | < | |
96 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp.x(), 78.01, OpenMD::NumericConstant::epsilon); |
97 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp.y(), 21.0, OpenMD::NumericConstant::epsilon); |
98 | > | CPPUNIT_ASSERT_DOUBLES_EQUAL(tmp.z(), 133.12, OpenMD::NumericConstant::epsilon); |
99 | > | |
100 | } | |
101 | ||
102 | void Vector3TestCase::testOtherTemplateFunctions(){ |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |