From: Thomas Geymayer Date: Thu, 25 Apr 2013 22:19:00 +0000 (+0200) Subject: Fix animation tests for low precision floating point X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4eabc45dfcae015d5c25386aacb513b68540f081;p=simgear.git Fix animation tests for low precision floating point --- diff --git a/simgear/scene/model/animation_test.cxx b/simgear/scene/model/animation_test.cxx index a072004f..19327a7d 100644 --- a/simgear/scene/model/animation_test.cxx +++ b/simgear/scene/model/animation_test.cxx @@ -3,8 +3,8 @@ #include #include -#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; }