MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / fulltext_log_assert_to_stream

Function fulltext_log_assert_to_stream

tests/framework/src/doctest.cpp:2562–2612  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2560 DOCTEST_REGISTER_REPORTER("xml", 0, XmlReporter);
2561
2562 void fulltext_log_assert_to_stream(std::ostream& s, const AssertData& rb) {
2563 if((rb.m_at & (assertType::is_throws_as | assertType::is_throws_with)) ==
2564 0) //!OCLINT bitwise operator in conditional
2565 s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << " ) "
2566 << Color::None;
2567
2568 if(rb.m_at & assertType::is_throws) { //!OCLINT bitwise operator in conditional
2569 s << (rb.m_threw ? "threw as expected!" : "did NOT throw at all!") << "\n";
2570 } else if((rb.m_at & assertType::is_throws_as) &&
2571 (rb.m_at & assertType::is_throws_with)) { //!OCLINT
2572 s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", \""
2573 << rb.m_exception_string.c_str()
2574 << "\", " << rb.m_exception_type << " ) " << Color::None;
2575 if(rb.m_threw) {
2576 if(!rb.m_failed) {
2577 s << "threw as expected!\n";
2578 } else {
2579 s << "threw a DIFFERENT exception! (contents: " << rb.m_exception << ")\n";
2580 }
2581 } else {
2582 s << "did NOT throw at all!\n";
2583 }
2584 } else if(rb.m_at &
2585 assertType::is_throws_as) { //!OCLINT bitwise operator in conditional
2586 s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", "
2587 << rb.m_exception_type << " ) " << Color::None
2588 << (rb.m_threw ? (rb.m_threw_as ? "threw as expected!" :
2589 "threw a DIFFERENT exception: ") :
2590 "did NOT throw at all!")
2591 << Color::Cyan << rb.m_exception << "\n";
2592 } else if(rb.m_at &
2593 assertType::is_throws_with) { //!OCLINT bitwise operator in conditional
2594 s << Color::Cyan << assertString(rb.m_at) << "( " << rb.m_expr << ", \""
2595 << rb.m_exception_string.c_str()
2596 << "\" ) " << Color::None
2597 << (rb.m_threw ? (!rb.m_failed ? "threw as expected!" :
2598 "threw a DIFFERENT exception: ") :
2599 "did NOT throw at all!")
2600 << Color::Cyan << rb.m_exception << "\n";
2601 } else if(rb.m_at & assertType::is_nothrow) { //!OCLINT bitwise operator in conditional
2602 s << (rb.m_threw ? "THREW exception: " : "didn't throw!") << Color::Cyan
2603 << rb.m_exception << "\n";
2604 } else {
2605 s << (rb.m_threw ? "THREW exception: " :
2606 (!rb.m_failed ? "is correct!\n" : "is NOT correct!\n"));
2607 if(rb.m_threw)
2608 s << rb.m_exception << "\n";
2609 else
2610 s << " values: " << assertString(rb.m_at) << "( " << rb.m_decomp << " )\n";
2611 }
2612 }
2613
2614 // TODO:
2615 // - log_message()

Callers 2

log_assertMethod · 0.85
log_assertMethod · 0.85

Calls 2

assertStringFunction · 0.85
c_strMethod · 0.45

Tested by

no test coverage detected