mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
* **Documentation** * Added new C coding style guide detailing naming conventions for files, directories, macros, constants, variables, functions, and type definitions with illustrative examples. * Updated C++ coding style documentation with clarifications on C naming conventions and header directory organization patterns. * **Refactor** * Updated header include paths throughout the codebase to use lowercase naming conventions consistently.
26 lines
606 B
C++
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);
|
|
}
|
|
|