188 |
|
void VectorTestCase::testAccessEntries(){ |
189 |
|
//test [] operator |
190 |
|
|
191 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero[0], 0.0, oopse::epsilon); |
192 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one[0] , 1.0, oopse::epsilon); |
193 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v3[0] , 4.0, oopse::epsilon); |
191 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero[0], 0.0, OpenMD::NumericConstant::epsilon); |
192 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one[0] , 1.0, OpenMD::NumericConstant::epsilon); |
193 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v3[0] , 4.0, OpenMD::NumericConstant::epsilon); |
194 |
|
//test () operator |
195 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v3(0) , 4.0, oopse::epsilon); |
195 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v3(0) , 4.0, OpenMD::NumericConstant::epsilon); |
196 |
|
|
197 |
|
Vec4 a1; |
198 |
|
double *pa1 = a1.getArrayPointer(); |
207 |
|
|
208 |
|
void VectorTestCase::testOtherMemberFunctions(){ |
209 |
|
//test length() |
210 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero.length(), 0.0, oopse::epsilon); |
211 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one.length(), 2.0, oopse::epsilon); |
212 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v2.length(), sqrt(14.0), oopse::epsilon); |
210 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero.length(), 0.0, OpenMD::NumericConstant::epsilon); |
211 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one.length(), 2.0, OpenMD::NumericConstant::epsilon); |
212 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v2.length(), sqrt(14.0), OpenMD::NumericConstant::epsilon); |
213 |
|
|
214 |
|
//test lengthSquare() |
215 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero.lengthSquare(), 0.0, oopse::epsilon); |
216 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one.lengthSquare(), 4.0, oopse::epsilon); |
217 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v2.lengthSquare(), 14.0, oopse::epsilon); |
215 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(zero.lengthSquare(), 0.0, OpenMD::NumericConstant::epsilon); |
216 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(one.lengthSquare(), 4.0, OpenMD::NumericConstant::epsilon); |
217 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(v2.lengthSquare(), 14.0, OpenMD::NumericConstant::epsilon); |
218 |
|
|
219 |
|
//test normalize() |
220 |
|
Vec4 a1 = one; |
231 |
|
//test getArray |
232 |
|
double tempV[4]; |
233 |
|
v3.getArray(tempV); |
234 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[0], v3[0], oopse::epsilon); |
235 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[1], v3[1], oopse::epsilon); |
236 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[2], v3[2], oopse::epsilon); |
237 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[3], v3[3], oopse::epsilon); |
234 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[0], v3[0], OpenMD::NumericConstant::epsilon); |
235 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[1], v3[1], OpenMD::NumericConstant::epsilon); |
236 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[2], v3[2], OpenMD::NumericConstant::epsilon); |
237 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(tempV[3], v3[3], OpenMD::NumericConstant::epsilon); |
238 |
|
} |
239 |
|
void VectorTestCase::testOtherTemplateFunctions(){ |
240 |
|
//test dot |
241 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(one, two), 8.0, oopse::epsilon); |
242 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(v1, v3), 20.0, oopse::epsilon); |
241 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(one, two), 8.0, OpenMD::NumericConstant::epsilon); |
242 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(dot(v1, v3), 20.0, OpenMD::NumericConstant::epsilon); |
243 |
|
|
244 |
|
//test distance |
245 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distance(one, two), 2.0, oopse::epsilon); |
246 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distance(v1, v2), sqrt(56.0), oopse::epsilon); |
245 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distance(one, two), 2.0, OpenMD::NumericConstant::epsilon); |
246 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distance(v1, v2), sqrt(56.0), OpenMD::NumericConstant::epsilon); |
247 |
|
|
248 |
|
//test distanceSquare |
249 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distanceSquare(one, two), 4.0, oopse::epsilon); |
250 |
< |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distanceSquare(v1, v2), 56, oopse::epsilon); |
249 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distanceSquare(one, two), 4.0, OpenMD::NumericConstant::epsilon); |
250 |
> |
CPPUNIT_ASSERT_DOUBLES_EQUAL(distanceSquare(v1, v2), 56, OpenMD::NumericConstant::epsilon); |
251 |
|
|
252 |
|
} |