| 7 | #include "fl/stl/static_assert.h" |
| 8 | |
| 9 | FL_TEST_FILE(FL_FILEPATH) { |
| 10 | |
| 11 | namespace delay_lookup_regression { |
| 12 | char delay(fl::u32); |
| 13 | using fl::delay; |
| 14 | |
| 15 | FL_STATIC_ASSERT(fl::is_same<decltype(delay(fl::u32{1})), char>::value, |
| 16 | "Bare delay(u32) should prefer the non-template Arduino-style overload"); |
| 17 | FL_STATIC_ASSERT(fl::is_same<decltype(delay(static_cast<unsigned long>(1))), char>::value, |
| 18 | "Bare delay(unsigned long) should prefer the non-template Arduino-style overload"); |
| 19 | FL_STATIC_ASSERT(fl::is_same<decltype(delay(fl::u32{1}, false)), void>::value, |
| 20 | "Two-argument delay(ms, run_async) should resolve to fl::delay"); |
| 21 | } // namespace delay_lookup_regression |
| 22 | |
| 23 | // ============================================================================ |
| 24 | // Test Suite: Compile-time Template Delays |
| 25 | // ============================================================================ |
| 26 | |
| 27 | FL_TEST_CASE("delayNanoseconds<50>() compiles") { |
| 28 | fl::delayNanoseconds<50>(); |
| 29 | FL_CHECK(true); |
| 30 | } |
| 31 | |
| 32 | FL_TEST_CASE("delayNanoseconds<100>() compiles") { |
| 33 | fl::delayNanoseconds<100>(); |
| 34 | FL_CHECK(true); |
| 35 | } |
| 36 | |
| 37 | FL_TEST_CASE("delayNanoseconds<350>() compiles (WS2812 T1)") { |
| 38 | fl::delayNanoseconds<350>(); |
| 39 | FL_CHECK(true); |
| 40 | } |
| 41 | |
| 42 | FL_TEST_CASE("delayNanoseconds<700>() compiles (WS2812 T2)") { |
| 43 | fl::delayNanoseconds<700>(); |
| 44 | FL_CHECK(true); |
| 45 | } |
| 46 | |
| 47 | FL_TEST_CASE("delayNanoseconds<1000>() compiles (1 microsecond)") { |
| 48 | fl::delayNanoseconds<1000>(); |
| 49 | FL_CHECK(true); |
| 50 | } |
| 51 | |
| 52 | FL_TEST_CASE("delayNanoseconds<10000>() compiles (10 microseconds)") { |
| 53 | fl::delayNanoseconds<10000>(); |
| 54 | FL_CHECK(true); |
| 55 | } |
| 56 | |
| 57 | // ============================================================================ |
| 58 | // Test Suite: Runtime Delays |
| 59 | // ============================================================================ |
| 60 | |
| 61 | FL_TEST_CASE("delayNanoseconds(0) does nothing") { |
| 62 | fl::delayNanoseconds(0); |
| 63 | FL_CHECK(true); |
| 64 | } |
| 65 | |
| 66 | FL_TEST_CASE("delayNanoseconds(50) compiles and runs") { |
nothing calls this directly
no test coverage detected