MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/system/delay.cpp:9–257  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7#include "fl/stl/static_assert.h"
8
9FL_TEST_FILE(FL_FILEPATH) {
10
11namespace delay_lookup_regression {
12char delay(fl::u32);
13using fl::delay;
14
15FL_STATIC_ASSERT(fl::is_same<decltype(delay(fl::u32{1})), char>::value,
16 "Bare delay(u32) should prefer the non-template Arduino-style overload");
17FL_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");
19FL_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
27FL_TEST_CASE("delayNanoseconds<50>() compiles") {
28 fl::delayNanoseconds<50>();
29 FL_CHECK(true);
30}
31
32FL_TEST_CASE("delayNanoseconds<100>() compiles") {
33 fl::delayNanoseconds<100>();
34 FL_CHECK(true);
35}
36
37FL_TEST_CASE("delayNanoseconds<350>() compiles (WS2812 T1)") {
38 fl::delayNanoseconds<350>();
39 FL_CHECK(true);
40}
41
42FL_TEST_CASE("delayNanoseconds<700>() compiles (WS2812 T2)") {
43 fl::delayNanoseconds<700>();
44 FL_CHECK(true);
45}
46
47FL_TEST_CASE("delayNanoseconds<1000>() compiles (1 microsecond)") {
48 fl::delayNanoseconds<1000>();
49 FL_CHECK(true);
50}
51
52FL_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
61FL_TEST_CASE("delayNanoseconds(0) does nothing") {
62 fl::delayNanoseconds(0);
63 FL_CHECK(true);
64}
65
66FL_TEST_CASE("delayNanoseconds(50) compiles and runs") {

Callers

nothing calls this directly

Calls 7

delayNanosecondsFunction · 0.85
delayMsFunction · 0.85
delayMillisFunction · 0.85
register_runnerMethod · 0.80
unregister_runnerMethod · 0.80
delayFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected