MCPcopy Create free account
hub / github.com/FastLED/FastLED / binaryAssert

Function binaryAssert

src/fl/test/fltest.h:357–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355// Binary assertion helper
356template<typename L, typename R, typename Cmp>
357bool 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

Callers

nothing calls this directly

Calls 3

SourceLocationClass · 0.85
reportAssertMethod · 0.80
strMethod · 0.45

Tested by

no test coverage detected