| 355 | // Binary assertion helper |
| 356 | template<typename L, typename R, typename Cmp> |
| 357 | bool binaryAssert(const L& lhs, const R& rhs, Cmp cmp, |
| 358 | const char* lhsExpr, const char* op, const char* rhsExpr, |
| 359 | const char* file, int line) FL_NOEXCEPT { |
| 360 | bool result = cmp(lhs, rhs); |
| 361 | |
| 362 | AssertResult ar(result); |
| 363 | ar.mLocation = SourceLocation(file, line); |
| 364 | |
| 365 | fl::sstream exprSS; |
| 366 | exprSS << lhsExpr << " " << op << " " << rhsExpr; |
| 367 | ar.mExpression = exprSS.str(); |
| 368 | |
| 369 | if (!result) { |
| 370 | fl::sstream expandedSS; |
| 371 | expandedSS << lhs << " " << op << " " << rhs; |
| 372 | ar.mExpanded = expandedSS.str(); |
| 373 | } |
| 374 | |
| 375 | TestContext::instance().reportAssert(ar); |
| 376 | return result; |
| 377 | } |
| 378 | |
| 379 | // ============================================================================= |
| 380 | // Approx class for floating point comparison |
nothing calls this directly
no test coverage detected