Tactility/Tests/TactilityKernel/Source/DispatcherTest.cpp
Ken Van Hoeylandt 79e43b093a
Kernel improvements (#485)
* **New Features**
  * Added public accessors for querying module/device start and ready state.

* **Refactor**
  * Internal state moved to opaque internal objects; module/device/driver initializers now explicitly initialize internal pointers.
  * Lifecycle handling updated to construct/destruct internal state and use accessors.

* **Tests**
  * Tests updated to use public accessors and explicit construct/destruct lifecycle calls.

* **Chores**
  * Test build/include paths and small metadata updated.
2026-02-06 16:32:30 +01:00

26 lines
606 B
C++

#include "doctest.h"
#include <tactility/freertos/task.h>
#include <tactility/concurrent/dispatcher.h>
TEST_CASE("dispatcher test") {
DispatcherHandle_t dispatcher = dispatcher_alloc();
CHECK_NE(dispatcher, nullptr);
int count = 0;
auto error = dispatcher_dispatch(dispatcher, &count, [](void* context) {
int* count_ptr = static_cast<int*>(context);
(*count_ptr)++;
});
CHECK_EQ(error, ERROR_NONE);
vTaskDelay(1);
CHECK_EQ(count, 0);
CHECK_EQ(dispatcher_consume(dispatcher), ERROR_NONE);
CHECK_EQ(count, 1);
dispatcher_free(dispatcher);
}