| 4 | #include "fl/stl/int.h" |
| 5 | |
| 6 | FL_TEST_FILE(FL_FILEPATH) { |
| 7 | |
| 8 | using namespace fl; |
| 9 | |
| 10 | // Test that the macros compile and suppress warnings |
| 11 | // These macros are used to silence compiler warnings about unused variables/functions |
| 12 | |
| 13 | // ============================================================================ |
| 14 | // TEST_CASE: FASTLED_UNUSED macro |
| 15 | // ============================================================================ |
| 16 | |
| 17 | FL_TEST_CASE("FASTLED_UNUSED macro") { |
| 18 | FL_SUBCASE("FASTLED_UNUSED is defined") { |
| 19 | // Verify the macro is defined |
| 20 | #ifdef FASTLED_UNUSED |
| 21 | FL_CHECK(true); |
| 22 | #else |
| 23 | FL_FAIL("FASTLED_UNUSED is not defined"); |
| 24 | #endif |
| 25 | } |
| 26 | |
| 27 | FL_SUBCASE("FASTLED_UNUSED with int variable") { |
| 28 | int unused_var = 42; |
| 29 | FASTLED_UNUSED(unused_var); |
| 30 | // If we get here without compiler warnings, the macro works |
| 31 | FL_CHECK(unused_var == 42); |
| 32 | } |
| 33 | |
| 34 | FL_SUBCASE("FASTLED_UNUSED with pointer") { |
| 35 | int value = 100; |
| 36 | int* unused_ptr = &value; |
| 37 | FASTLED_UNUSED(unused_ptr); |
| 38 | FL_CHECK(*unused_ptr == 100); |
| 39 | } |
| 40 | |
| 41 | FL_SUBCASE("FASTLED_UNUSED with const variable") { |
| 42 | const double unused_const = 3.14; |
| 43 | FASTLED_UNUSED(unused_const); |
| 44 | FL_CHECK(unused_const == doctest::Approx(3.14)); |
| 45 | } |
| 46 | |
| 47 | FL_SUBCASE("FASTLED_UNUSED with struct") { |
| 48 | struct TestStruct { |
| 49 | int x; |
| 50 | int y; |
| 51 | }; |
| 52 | TestStruct unused_struct = {10, 20}; |
| 53 | FASTLED_UNUSED(unused_struct); |
| 54 | FL_CHECK(unused_struct.x == 10); |
| 55 | FL_CHECK(unused_struct.y == 20); |
| 56 | } |
| 57 | |
| 58 | FL_SUBCASE("FASTLED_UNUSED with multiple calls") { |
| 59 | int a = 1; |
| 60 | int b = 2; |
| 61 | int c = 3; |
| 62 | FASTLED_UNUSED(a); |
| 63 | FASTLED_UNUSED(b); |
nothing calls this directly
no test coverage detected