Fix animation tests for low precision floating point

This commit is contained in:
Thomas Geymayer
2013-04-26 00:19:00 +02:00
parent 5c5e2a0f2f
commit 4eabc45dfc

View File

@@ -3,8 +3,8 @@
#include <cstring>
#include <iostream>
#define COMPARE(a, b) \
if( (a) != (b) ) \
#define VERIFY_CLOSE(a, b) \
if( norm((a) - (b)) > 1e-5 ) \
{ \
std::cerr << "line " << __LINE__ << ": failed: "\
<< #a << " != " << #b\
@@ -50,8 +50,8 @@ int main(int argc, char* argv[])
config->setDoubleValue("axis/z2-m", v2.z());
anim.readConfig();
COMPARE(anim.center, (v1 + v2) * 0.5)
COMPARE(anim.axis, normalize(v2 - v1))
VERIFY_CLOSE(anim.center, (v1 + v2) * 0.5)
VERIFY_CLOSE(anim.axis, normalize(v2 - v1))
config->removeChild("axis", 0, false);
config->setDoubleValue("center/x-m", v1.x());
@@ -62,8 +62,8 @@ int main(int argc, char* argv[])
config->setDoubleValue("axis/z", v2.z());
anim.readConfig();
COMPARE(anim.center, v1)
COMPARE(anim.axis, normalize(v2))
VERIFY_CLOSE(anim.center, v1)
VERIFY_CLOSE(anim.axis, normalize(v2))
return 0;
}