FastLED 3.9.15
Loading...
Searching...
No Matches
test_helpers.h
Go to the documentation of this file.
1// examples/SIMD/test_helpers.h
2//
3// Helper functions for SIMD testing
4
5#pragma once
6
7#include <FastLED.h>
8#include "test_result.h"
9
10namespace simd_test {
11
12// ============================================================================
13// Array Comparison Functions
14// ============================================================================
15
21bool compare_u8_arrays(const uint8_t* a, const uint8_t* b, size_t count);
22
29bool compare_f32_arrays(const float* a, const float* b, size_t count, float epsilon = 0.001f);
30
31// ============================================================================
32// Test Execution Functions
33// ============================================================================
34
37void print_test_result(const TestResult& result);
38
46template<typename TestFunc>
47void run_test(const char* test_name, TestFunc test_func,
49 int& total_tests, int& passed_tests, int& failed_tests) {
51 TestResult result(test_name);
52
53 // Execute test function
54 test_func(result);
55
56 // Update statistics
57 if (result.passed) {
59 } else {
61 }
62
63 // Print result
64 print_test_result(result);
65
66 // Store result
67 results.push_back(result);
68}
69
70// ============================================================================
71// Summary and Reporting Functions
72// ============================================================================
73
81
85
86} // namespace simd_test
int passed_tests
Definition SIMD.ino:75
int failed_tests
Definition SIMD.ino:76
int total_tests
Definition SIMD.ino:74
fl::vector< TestResult > test_results
Definition SIMD.ino:71
void push_back(const T &value) FL_NOEXCEPT
Definition vector.h:624
void print_test_result(const TestResult &result)
Print test result to serial.
void run_test(const char *test_name, TestFunc test_func, fl::vector< TestResult > &results, int &total_tests, int &passed_tests, int &failed_tests)
Run a single test and record result.
void print_final_banner(int failed_tests)
Print final result banner (PASS/FAIL)
bool compare_u8_arrays(const uint8_t *a, const uint8_t *b, size_t count)
Compare two uint8_t arrays element-wise.
void print_summary(const fl::vector< TestResult > &test_results, int total_tests, int passed_tests, int failed_tests)
Print summary table of all test results.
bool compare_f32_arrays(const float *a, const float *b, size_t count, float epsilon)
Compare two float arrays element-wise with epsilon tolerance.
Stores the result of a single SIMD test.
Definition test_result.h:10