FastLED 3.10.8
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 14 of file result_formatter.cpp.hpp.

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

References fl::FL_NO_EXCEPT, fl::basic_string::length(), 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: