Add unit testing suite (doctest + CTest) #12

Open
opened 2026-09-25 19:35:56 -07:00 by burkkyy · 0 comments
Owner

Set up a unit testing suite for engine logic that runs without a window or GPU.

Setup

  • Add doctest as a submodule in third_party/
  • enable_testing() in the root CMakeLists.txt
  • New top-level tests/ dir, one test executable per module (e.g. tests/util/, tests/jobs/), each registered with CTest
  • Add a dev test command to bin/dev that builds and runs ctest --test-dir build --output-on-failure

Initial tests

  • util/pool.hpp: create/destroy, slot reuse, stale handles rejected after generation bump
  • handles.hpp: invalid handle behavior, equality
  • util/delegate.hpp: bind/invoke/unbind

Scope

In scope: pure logic that doesn't need a window or GPU (util, handles, scene/entity ops, jobs, render graph barrier/ordering logic if it can run without a device).

Out of scope: Vulkan rendering correctness. That stays covered by testbed/ and examples/.

Later

  • ThreadSanitizer build preset for the jobs system tests (#11)
  • CI once there's a runner

Done when

  • dev test builds and runs all tests from a clean build
  • Pool, handle and delegate tests pass
Set up a unit testing suite for engine logic that runs without a window or GPU. ## Setup - Add [doctest](https://github.com/doctest/doctest) as a submodule in `third_party/` - `enable_testing()` in the root `CMakeLists.txt` - New top-level `tests/` dir, one test executable per module (e.g. `tests/util/`, `tests/jobs/`), each registered with CTest - Add a `dev test` command to `bin/dev` that builds and runs `ctest --test-dir build --output-on-failure` ## Initial tests - `util/pool.hpp`: create/destroy, slot reuse, stale handles rejected after generation bump - `handles.hpp`: invalid handle behavior, equality - `util/delegate.hpp`: bind/invoke/unbind ## Scope In scope: pure logic that doesn't need a window or GPU (util, handles, scene/entity ops, jobs, render graph barrier/ordering logic if it can run without a device). Out of scope: Vulkan rendering correctness. That stays covered by `testbed/` and `examples/`. ## Later - ThreadSanitizer build preset for the jobs system tests (#11) - CI once there's a runner ## Done when - `dev test` builds and runs all tests from a clean build - Pool, handle and delegate tests pass
burkkyy added the enhancement label 2026-09-25 19:35:56 -07:00
burkkyy added this to the sophia project 2026-09-25 19:36:05 -07:00
burkkyy moved this to Blocked in sophia on 2026-09-25 20:42:54 -07:00
Sign in to join this conversation.