FastLED 3.10.8
Loading...
Searching...
No Matches
result_formatter.cpp.hpp
Go to the documentation of this file.
1// src/fl/channels/detail/validation/result_formatter.cpp.hpp
2//
3// Result formatting implementation
4
7#include "fl/stl/sstream.h"
8#include "fl/log/log.h"
9#include "fl/stl/noexcept.h"
10
11namespace fl {
12namespace validation {
13
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}
75
77 FL_WARN(formatSummaryTable(driver_results).c_str());
78}
79
80} // namespace validation
81} // namespace fl
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
#define FL_WARN(...)
Definition log.h:437
Centralized logging categories for FastLED hardware interfaces and subsystems.
void printSummaryTable(const fl::vector< fl::DriverTestResult > &driver_results) FL_NO_EXCEPT
Print driver validation summary table to log.
string formatSummaryTable(const fl::vector< fl::DriverTestResult > &driver_results) FL_NO_EXCEPT
Format driver validation results as a summary table.
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
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
Base definition for an LED controller.