MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/Falcor / createFullMessage

Function createFullMessage

Source/Falcor/Testing/UnitTest.h:411–434  ·  view source on GitHub ↗

A test has failed when there is a failureMsg, if the value is not set, the test has passed

Source from the content-addressed store, hash-verified

409
410/// A test has failed when there is a failureMsg, if the value is not set, the test has passed
411inline StreamSink createFullMessage(
412 UnitTestContext& ctx,
413 std::optional<std::string> failureMsg,
414 std::string_view userMsg,
415 bool isAssert,
416 std::string_view file,
417 int line
418)
419{
420 if (!failureMsg)
421 return StreamSink(nullptr);
422
423 if (++ctx.mNumFailures == kMaxTestFailures)
424 throw TooManyFailedTestsException();
425
426 StreamSink ss(&ctx);
427 ss << fmt::format("{}:{}:\nerror: {}", file, line, *failureMsg);
428 if (!userMsg.empty())
429 ss << "\n" << userMsg;
430 if (isAssert)
431 throw AssertingTestException("Test asserted, couldn't continue.");
432 ss.setInsertNewLine();
433 return ss;
434}
435
436#define FTEST_ASSERT_RESULT true
437#define FTEST_EXPECT_RESULT false

Callers

nothing calls this directly

Calls 5

StreamSinkClass · 0.85
setInsertNewLineMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected