
7 Apr
2010
7 Apr
'10
2:16 p.m.
Hi, This bit of Boost.Test code fails: ////////////////////////////////////////////////////////////////////// BOOST_AUTO_TEST_CASE( nantest ) { float a,b; a = b = 1.0; BOOST_CHECK_EQUAL( a, b ); // passes a = b = NAN; BOOST_CHECK_EQUAL( a, b ); // fails } ////////////////////////////////////////////////////////////////////// The failure is because, by definition, NAN != NAN. What I'm after is a test macro which takes this into account and will pass the equality test when both elements are NAN. BOOST_CHECK_CLOSE has the same behaviour. Is the best solution to write my own custom predicate? Brian