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

Function FL_TEST_FILE

tests/fl/task/executor.cpp:24–1072  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include "platforms/coroutine_runtime.h" // for is_shutdown_requested()
23
24FL_TEST_FILE(FL_FILEPATH) {
25
26using namespace fl;
27using fl::task::Executor;
28using fl::task::Runner;
29using fl::task::Scheduler;
30using fl::task::run;
31using fl::task::active_tasks;
32using fl::task::has_tasks;
33using fl::task::CoroutineConfig;
34
35// Test helper: A simple test async runner
36class TestAsyncRunner : public fl::task::Runner {
37public:
38 TestAsyncRunner() : update_count(0), active(false), task_count(0) {}
39
40 void update() override {
41 update_count++;
42 }
43
44 bool has_active_tasks() const override {
45 return active;
46 }
47
48 size_t active_task_count() const override {
49 return task_count;
50 }
51
52 void set_active(bool value) { active = value; }
53 void set_task_count(size_t count) { task_count = count; }
54
55 int update_count;
56
57private:
58 bool active;
59 size_t task_count;
60};
61
62FL_TEST_CASE("fl::task::Runner interface") {
63 FL_SUBCASE("basic implementation") {
64 TestAsyncRunner runner;
65
66 FL_CHECK_EQ(runner.update_count, 0);
67 FL_CHECK_EQ(runner.has_active_tasks(), false);
68 FL_CHECK_EQ(runner.active_task_count(), 0);
69
70 runner.update();
71 FL_CHECK_EQ(runner.update_count, 1);
72
73 runner.set_active(true);
74 runner.set_task_count(5);
75 FL_CHECK_EQ(runner.has_active_tasks(), true);
76 FL_CHECK_EQ(runner.active_task_count(), 5);
77 }
78}
79
80FL_TEST_CASE("fl::task::Executor") {
81 FL_SUBCASE("singleton instance") {

Callers

nothing calls this directly

Calls 15

active_tasksFunction · 0.85
has_tasksFunction · 0.85
await_top_levelFunction · 0.85
ErrorClass · 0.85
createFunction · 0.85
every_msFunction · 0.85
before_frameFunction · 0.85
after_frameFunction · 0.85
coroutineFunction · 0.85
printfFunction · 0.85
set_activeMethod · 0.80

Tested by

no test coverage detected