| 3 | #include "test.h" |
| 4 | |
| 5 | FL_TEST_FILE(FL_FILEPATH) { |
| 6 | |
| 7 | using namespace fl; |
| 8 | using namespace noise_test_helpers; |
| 9 | |
| 10 | // Temporarily disable all non-critical noise tests for faster test runs |
| 11 | // These can be re-enabled when needed for in-depth noise validation |
| 12 | // Includes noise ring, sphere, and cylinder tests (cylinder merged from noise_cylinder.cpp) |
| 13 | #if 0 |
| 14 | |
| 15 | FL_TEST_CASE("[.]noiseRingHSV8 temporal smoothness - small time delta") { |
| 16 | const int NUM_LEDS = 128; |
| 17 | const float ANGLE_STEP = 2.0f * M_PI / NUM_LEDS; |
| 18 | |
| 19 | CRGB frame_t0[NUM_LEDS]; |
| 20 | CRGB frame_t1[NUM_LEDS]; |
| 21 | |
| 22 | uint32_t time_base = 5000; |
| 23 | float radius = 1.0f; |
| 24 | |
| 25 | // Generate frame at time t0 |
| 26 | for (int i = 0; i < NUM_LEDS; i++) { |
| 27 | float angle = i * ANGLE_STEP; |
| 28 | CHSV hsv = noiseRingHSV8(angle, time_base, radius); |
| 29 | frame_t0[i] = hsv; |
| 30 | } |
| 31 | |
| 32 | // Generate frame at t0 + 1ms (small time delta) |
| 33 | // Noise should change very smoothly - small average color difference |
| 34 | for (int i = 0; i < NUM_LEDS; i++) { |
| 35 | float angle = i * ANGLE_STEP; |
| 36 | CHSV hsv = noiseRingHSV8(angle, time_base + 1, radius); |
| 37 | frame_t1[i] = hsv; |
| 38 | } |
| 39 | |
| 40 | float avg_diff_1ms = calcAverageColorDifference(frame_t0, frame_t1, NUM_LEDS); |
| 41 | |
| 42 | FL_WARN("=== noiseRingHSV8 Temporal Smoothness Test (Δt=1ms) ==="); |
| 43 | FL_WARN("Average color pixel difference: " << avg_diff_1ms); |
| 44 | FL_WARN("Threshold for smooth animation: < 5.0"); |
| 45 | |
| 46 | // At 1ms, the noise should change only minimally |
| 47 | // This tests that the noise function provides smooth animation |
| 48 | // as time progresses in small increments |
| 49 | FL_CHECK_LT(avg_diff_1ms, 5.0f); |
| 50 | } |
| 51 | |
| 52 | FL_TEST_CASE("[.]noiseRingHSV8 temporal evolution - large time delta") { |
| 53 | const int NUM_LEDS = 128; |
| 54 | const float ANGLE_STEP = 2.0f * M_PI / NUM_LEDS; |
| 55 | |
| 56 | CRGB frame_t0[NUM_LEDS]; |
| 57 | CRGB frame_t1[NUM_LEDS]; |
| 58 | |
| 59 | uint32_t time_base = 1000; |
| 60 | float radius = 1.0f; |
| 61 | |
| 62 | // Generate frame at time t0 |
nothing calls this directly
no test coverage detected