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

◆ formatSummaryTable()

string fl::validation::formatSummaryTable ( const fl::vector< fl::DriverTestResult > & driver_results)

Format driver validation results as a summary table.

Parameters
driver_resultsVector of driver test results
Returns
Formatted table string

Definition at line 13 of file result_formatter.cpp.hpp.

13 {
14 fl::sstream ss;
15 ss << "\n╔════════════════════════════════════════════════════════════════╗\n";
16 ss << "║ DRIVER VALIDATION SUMMARY ║\n";
17 ss << "╠════════════════════════════════════════════════════════════════╣\n";
18 ss << "║ Driver │ Status │ Tests Passed │ Total Tests ║\n";
19 ss << "╠══════════════╪═════════════╪══════════════╪═══════════════════╣\n";
20
21 for (fl::size i = 0; i < driver_results.size(); i++) {
22 const auto& result = driver_results[i];
23 const char* status;
24 if (result.skipped) {
25 status = "SKIPPED ";
26 } else if (result.allPassed()) {
27 status = "PASS ✓ ";
28 } else if (result.anyFailed()) {
29 status = "FAIL ✗ ";
30 } else {
31 status = "NO TESTS ";
32 }
33
34 // Build table row
35 ss << "║ ";
36
37 // Driver name (12 chars, left-aligned)
38 fl::string driver_name = result.driver_name;
39 if (driver_name.length() > 12) {
40 driver_name = driver_name.substr(0, 12);
41 }
42 ss << driver_name;
43 for (size_t j = driver_name.length(); j < 12; j++) {
44 ss << " ";
45 }
46 ss << " │ " << status << " │ ";
47
48 // Tests passed (12 chars, left-aligned)
49 if (result.skipped) {
50 ss << "-";
51 for (int j = 1; j < 12; j++) ss << " ";
52 } else {
53 fl::string passed = fl::to_string(result.passed_tests);
54 ss << passed;
55 for (size_t j = passed.length(); j < 12; j++) ss << " ";
56 }
57 ss << " │ ";
58
59 // Total tests (17 chars, left-aligned)
60 if (result.skipped) {
61 ss << "-";
62 for (int j = 1; j < 17; j++) ss << " ";
63 } else {
64 fl::string total = fl::to_string(result.total_tests);
65 ss << total;
66 for (size_t j = total.length(); j < 17; j++) ss << " ";
67 }
68 ss << " ║\n";
69 }
70
71 ss << "╚══════════════╧═════════════╧══════════════╧═══════════════════╝";
72 return ss.str();
73}
fl::size length() const FL_NOEXCEPT
string str() const FL_NOEXCEPT
Definition strstream.h:43
string substr(fl::size start, fl::size length) const FL_NOEXCEPT
fl::size size() const FL_NOEXCEPT
string to_string(T value) FL_NOEXCEPT
Definition string.h:450
expected< T, E > result
Alias for expected (Rust-style naming)
Definition result.h:31

References fl::basic_string::length(), fl::vector_basic::size(), fl::sstream::str(), fl::string::substr(), and fl::to_string().

Referenced by printSummaryTable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: