QA: Account for eeschema tests unit rounding

This commit is contained in:
John Beard 2019-01-30 09:37:15 +00:00 committed by jean-pierre charras
parent 8e75f6029c
commit 9a41fd060b
2 changed files with 4 additions and 2 deletions

View File

@ -31,6 +31,8 @@
#include <qa_utils/geometry/poly_set_construction.h> #include <qa_utils/geometry/poly_set_construction.h>
#include <qa_utils/geometry/seg_construction.h> #include <qa_utils/geometry/seg_construction.h>
#include <unit_test_utils/geometry.h>
/** /**
* Declares the Boost test suite fixture. * Declares the Boost test suite fixture.
*/ */
@ -141,7 +143,7 @@ BOOST_AUTO_TEST_CASE( SegDistance )
int dist = polyset.Distance( c.m_seg, c.m_seg_width ); int dist = polyset.Distance( c.m_seg, c.m_seg_width );
// right answer? // right answer?
BOOST_CHECK_EQUAL( dist, c.m_exp_dist ); BOOST_CHECK_PREDICATE( KI_TEST::IsWithin<int>, ( dist )( c.m_exp_dist )( 1 ) );
} }
} }
} }

View File

@ -14,7 +14,7 @@
* *
* TODO: convert to boost_test_print_type when Boost minver > 1.64 * TODO: convert to boost_test_print_type when Boost minver > 1.64
*/ */
std::ostream& operator<<( std::ostream& os, const BOX2I& aBox ) inline std::ostream& operator<<( std::ostream& os, const BOX2I& aBox )
{ {
os << "BOX[ " << aBox.GetOrigin() << " + " << aBox.GetSize() << " ]"; os << "BOX[ " << aBox.GetOrigin() << " + " << aBox.GetSize() << " ]";
return os; return os;