From c61231fad97f441ee0c0a0285e22b09527cecdd0 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Wed, 9 Apr 2014 10:01:19 -0700 Subject: [PATCH] Fix BackwardTest failure which was just compiler-drive differences in floating point precision. BOOST_CHECK_CLOSE's tolerance is proportional to the value on the left, so 0.0 has zero tolerance. Changed to an explicit range. --- moses/LM/BackwardTest.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/moses/LM/BackwardTest.cpp b/moses/LM/BackwardTest.cpp index 7fed72270..96fa739b0 100644 --- a/moses/LM/BackwardTest.cpp +++ b/moses/LM/BackwardTest.cpp @@ -159,7 +159,9 @@ public: BOOST_CHECK( oovCount == 0 ); SLOPPY_CHECK_CLOSE( TransformLMScore(p_licenses + p_the_licenses), fullScore, 0.01); - SLOPPY_CHECK_CLOSE( TransformLMScore( 0.0 ), ngramScore, 0.01); + // Check ngramScore is 0.0 + BOOST_CHECK_GT(0.0001, ngramScore); + BOOST_CHECK_LT(-0.0001, ngramScore); } // the licenses for