| 15 | |
| 16 | template <typename T, typename U> |
| 17 | void require_eq(const T & actual, const U & expected, const std::string & label) { |
| 18 | if (!(actual == expected)) { |
| 19 | std::ostringstream oss; |
| 20 | oss << label << " mismatch: expected=" << expected << " actual=" << actual; |
| 21 | throw std::runtime_error(oss.str()); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | inline void require_close(float actual, float expected, float tolerance, const std::string & label) { |
| 26 | const float diff = std::fabs(actual - expected); |
no test coverage detected