| 6 | #include "fl/channels/validation.h" |
| 7 | |
| 8 | FL_TEST_FILE(FL_FILEPATH) { |
| 9 | |
| 10 | using namespace fl; |
| 11 | |
| 12 | // Basic test configuration |
| 13 | SingleTestConfig makeBasicConfig() { |
| 14 | SingleTestConfig config; |
| 15 | config.driver_name = "PARLIO"; |
| 16 | config.lane_sizes = {100}; |
| 17 | config.pattern = "MSB_LSB_A"; |
| 18 | config.iterations = 1; |
| 19 | config.pin_tx = 1; |
| 20 | config.pin_rx = 0; |
| 21 | return config; |
| 22 | } |
| 23 | |
| 24 | FL_TEST_CASE("Basic configuration succeeds") { |
| 25 | SingleTestConfig config = makeBasicConfig(); |
| 26 | SingleTestResult result = runSingleValidationTest(config); |
| 27 | |
| 28 | FL_CHECK(result.success); |
| 29 | FL_CHECK(result.driver == "PARLIO"); |
| 30 | FL_CHECK(result.lane_count == 1); |
| 31 | FL_CHECK(result.lane_sizes.size() == 1u); |
| 32 | FL_CHECK(result.lane_sizes[0] == 100); |
| 33 | } |
| 34 | |
| 35 | FL_TEST_CASE("Multi-lane configuration") { |
| 36 | SingleTestConfig config = makeBasicConfig(); |
| 37 | config.lane_sizes = {100, 200, 150}; |
| 38 | |
| 39 | SingleTestResult result = runSingleValidationTest(config); |
| 40 | |
| 41 | FL_CHECK(result.success); |
| 42 | FL_CHECK(result.lane_count == 3); |
| 43 | FL_CHECK(result.lane_sizes.size() == 3u); |
| 44 | FL_CHECK(result.lane_sizes[0] == 100); |
| 45 | FL_CHECK(result.lane_sizes[1] == 200); |
| 46 | FL_CHECK(result.lane_sizes[2] == 150); |
| 47 | } |
| 48 | |
| 49 | FL_TEST_CASE("Invalid lane count - 0 lanes") { |
| 50 | SingleTestConfig config = makeBasicConfig(); |
| 51 | config.lane_sizes.clear(); |
| 52 | |
| 53 | SingleTestResult result = runSingleValidationTest(config); |
| 54 | |
| 55 | FL_CHECK_FALSE(result.success); |
| 56 | FL_CHECK(result.error_message.has_value()); |
| 57 | } |
| 58 | |
| 59 | FL_TEST_CASE("Invalid lane count - more than 16 lanes") { |
| 60 | SingleTestConfig config = makeBasicConfig(); |
| 61 | config.lane_sizes = { |
| 62 | 100, 100, 100, 100, 100, 100, 100, 100, 100, |
| 63 | 100, 100, 100, 100, 100, 100, 100, 100}; // 17 lanes |
| 64 | |
| 65 | SingleTestResult result = runSingleValidationTest(config); |
nothing calls this directly
no test coverage detected