Fix bug in WithinAbs::match() and add tests for it

This commit is contained in:
jsc
2018-03-19 20:36:07 +01:00
committed by Martin Hořeňovský
parent 6c99b04c87
commit 8b78087412
7 changed files with 138 additions and 8 deletions

View File

@@ -88,7 +88,7 @@ namespace Floating {
// Performs equivalent check of std::fabs(lhs - rhs) <= margin
// But without the subtraction to allow for INFINITY in comparison
bool WithinAbsMatcher::match(double const& matchee) const {
return (matchee + m_margin >= m_target) && (m_target + m_margin >= m_margin);
return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);
}
std::string WithinAbsMatcher::describe() const {