FastLED 3.10.6
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 658 of file fltest.cpp.hpp.

658 {
659 fl::sstream ss;
660 ss << " <testcase name=\"" << escapeXml(mCurrentTestName.c_str()) << "\"";
661
662 // Add time attribute if duration is available (convert ms to seconds)
663 if (durationMs > 0) {
664 // Format as seconds with millisecond precision
665 fl::u32 secs = durationMs / 1000;
666 fl::u32 millis = durationMs % 1000;
667 ss << " time=\"" << secs << "." << (millis < 100 ? (millis < 10 ? "00" : "0") : "") << millis << "\"";
668 }
669
670 if (passed) {
671 ss << "/>\n";
672 } else {
673 ss << ">\n";
674 ss << " <failure message=\"Test failed\">\n";
675 ss << "<![CDATA[" << mCurrentTestFailures << "]]>\n";
676 ss << " </failure>\n";
677 ss << " </testcase>\n";
678 }
679
680 mTestCaseResults.push_back(ss.str());
681}
string str() const FL_NO_EXCEPT
Definition strstream.h:43
static fl::string escapeXml(const char *text) FL_NO_EXCEPT
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::FL_NO_EXCEPT, mCurrentTestFailures, mCurrentTestName, fl::millis(), mTestCaseResults, and fl::sstream::str().

+ Here is the call graph for this function: