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

Function FL_TEST_FILE

tests/fl/channels/channel_manager.cpp:30–301  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28// doesn't reference any cstdio.h symbol directly anyway.
29
30FL_TEST_FILE(FL_FILEPATH) {
31
32
33
34using namespace fl;
35
36// Test helper for capturing debug output
37namespace 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
55class FakeEngine : public IChannelDriver {
56public:
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);

Callers

nothing calls this directly

Calls 9

addDriverMethod · 0.80
removeDriverMethod · 0.80
getDriverByNameMethod · 0.80
pollMethod · 0.45
getDriverCountMethod · 0.45
getDriverInfosMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
setDriverEnabledMethod · 0.45

Tested by

no test coverage detected