| 28 | // doesn't reference any cstdio.h symbol directly anyway. |
| 29 | |
| 30 | FL_TEST_FILE(FL_FILEPATH) { |
| 31 | |
| 32 | |
| 33 | |
| 34 | using namespace fl; |
| 35 | |
| 36 | // Test helper for capturing debug output |
| 37 | namespace test_helper { |
| 38 | static fl::string captured_output; |
| 39 | |
| 40 | void capture_print(const char* str) { |
| 41 | captured_output += str; |
| 42 | } |
| 43 | |
| 44 | void clear_capture() { |
| 45 | captured_output.clear(); |
| 46 | } |
| 47 | |
| 48 | fl::string get_capture() { |
| 49 | return captured_output; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | /// Simple fake driver for testing - no mocks needed |
| 54 | /// Tracks transmission calls without actually transmitting |
| 55 | class FakeEngine : public IChannelDriver { |
| 56 | public: |
| 57 | FakeEngine(const char* name, bool shouldFail = false, |
| 58 | bool supportsClockless = true, bool supportsSpi = false) |
| 59 | : mName(name), mShouldFail(shouldFail), |
| 60 | mCapabilities(supportsClockless, supportsSpi) { |
| 61 | } |
| 62 | |
| 63 | ~FakeEngine() override { |
| 64 | } |
| 65 | |
| 66 | // Test accessors |
| 67 | int getTransmitCount() const { return mTransmitCount; } |
| 68 | int getLastChannelCount() const { return mLastChannelCount; } |
| 69 | fl::string getName() const override { return mName; } |
| 70 | Capabilities getCapabilities() const override { return mCapabilities; } |
| 71 | void reset() { mTransmitCount = 0; mLastChannelCount = 0; } |
| 72 | void setShouldFail(bool shouldFail) { mShouldFail = shouldFail; } |
| 73 | |
| 74 | bool canHandle(const ChannelDataPtr& data) const override { |
| 75 | (void)data; |
| 76 | return true; // Test driver accepts all channel types |
| 77 | } |
| 78 | |
| 79 | void enqueue(ChannelDataPtr channelData) override { |
| 80 | if (channelData) { |
| 81 | mEnqueuedChannels.push_back(channelData); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | void show() override { |
| 86 | if (!mEnqueuedChannels.empty()) { |
| 87 | mTransmittingChannels = fl::move(mEnqueuedChannels); |
nothing calls this directly
no test coverage detected