diff options
| author | nodist <kevin.comas.git@gmail.com> | 2026-11-11 14:05:59 -0500 |
|---|---|---|
| committer | nodist <kevin.comas.git@gmail.com> | 2026-11-11 14:05:59 -0500 |
| commit | 75c8828d804f45cf8f44af73bfe87e0f3eaf9a9e (patch) | |
| tree | 2fdf51906d2517bbe8c928fc52f95bb2e0dda4f9 /test/task.c | |
| parent | 7b9204a8680539bc4795a14f3d9a34e47981d0c3 (diff) | |
run a task test
Diffstat (limited to 'test/task.c')
| -rw-r--r-- | test/task.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/task.c b/test/task.c new file mode 100644 index 0000000..8374989 --- /dev/null +++ b/test/task.c @@ -0,0 +1,24 @@ + +#include "kpl_test.h" + +static int32_t run_task_value = 0; + +#define KPL_RUN_TASK_SET_VALUE 1234567 + +void run_task_set_value(kpl_thread *thread, kpl_object_task *object_task) { + run_task_value = KPL_RUN_TASK_SET_VALUE; + kpl_object_task_done(thread, object_task); +} + +KPL_TEST(run_task) { + kpl_env env = {}; + kpl_env_config(&env, -1, NULL); + env.thread_count = 1; + env.io_uring_queue_size_pow2 = KPL_IO_URING_QUEUE_SIZE_POW2_MIN; + env.flags |= KPL_ENV_FLAG_RUN_FUNCTION; + env.kpl_fn_entry = run_task_set_value; + KPL_ASSERT(kpl_env_init(&env) == KPL_EXIT_CODE_SUCCESS, "env should init"); + KPL_ASSERT(kpl_env_run(&env) == KPL_EXIT_CODE_SUCCESS, "env should run"); + kpl_env_free(&env); + KPL_ASSERT(run_task_value == KPL_RUN_TASK_SET_VALUE, "task should have set value"); +} |
