FastLED 3.9.15
Loading...
Searching...
No Matches

◆ testCaseEnd()

void fl::test::XMLReporter::testCaseEnd ( bool passed,
fl::u32 durationMs = 0 )
overridevirtual

Called when a test case ends.

Parameters
passedWhether the test passed
durationMsDuration of the test in milliseconds (0 if no timer available)

Implements fl::test::IReporter.

Definition at line 649 of file fltest.cpp.hpp.

649 {
650 fl::sstream ss;
651 ss << " <testcase name=\"" << escapeXml(mCurrentTestName.c_str()) << "\"";
652
653 // Add time attribute if duration is available (convert ms to seconds)
654 if (durationMs > 0) {
655 // Format as seconds with millisecond precision
656 fl::u32 secs = durationMs / 1000;
657 fl::u32 millis = durationMs % 1000;
658 ss << " time=\"" << secs << "." << (millis < 100 ? (millis < 10 ? "00" : "0") : "") << millis << "\"";
659 }
660
661 if (passed) {
662 ss << "/>\n";
663 } else {
664 ss << ">\n";
665 ss << " <failure message=\"Test failed\">\n";
666 ss << "<![CDATA[" << mCurrentTestFailures << "]]>\n";
667 ss << " </failure>\n";
668 ss << " </testcase>\n";
669 }
670
671 mTestCaseResults.push_back(ss.str());
672}
string str() const FL_NOEXCEPT
Definition strstream.h:43
static fl::string escapeXml(const char *text) FL_NOEXCEPT
fl::vector< fl::string > mTestCaseResults
Definition fltest.h:581
fl::string mCurrentTestName
Definition fltest.h:578
fl::string mCurrentTestFailures
Definition fltest.h:579
fl::u32 millis()
Universal millisecond timer - returns milliseconds since system startup.

References escapeXml(), FL_NOEXCEPT, mCurrentTestFailures, mCurrentTestName, fl::millis(), mTestCaseResults, and fl::sstream::str().

+ Here is the call graph for this function: