Files
partridge-cpp/TESTING.md
T
Codex instance 0b65501c73 test: add independent placement validation
Establish a CTest harness before changing solver behavior. Validate board dimensions, multiplicities, bounds, overlap and coverage against independent placement data, including known order-8 and constructed order-9 fixtures.

Document Debug and sanitizer workflows while keeping the defects tracked by #7 and #14 separate. Prepare a result adapter so the feasible solver regression can be enabled with the completion fix.

Tests: Release, ASan and UBSan CTest suites (3 passed each)

Refs: #1
2026-07-30 16:40:29 +01:00

1.6 KiB

Testing

The default test suite is deterministic and has no elapsed-time assertions. Configure a build, compile it, and run the tests with CTest:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build
ctest --test-dir build --output-on-failure

The tests independently check board dimensions, square multiplicities, bounds, overlap, and complete coverage. They cover small unsatisfiable solver inputs, a known order-8 solution, invalid placement diagnostics, and construction of an order-9 solution from the order-8 fixture.

Debug and sanitizers

Use a separate build directory for each configuration:

cmake -S . -B build-debug -DCMAKE_BUILD_TYPE=Debug
cmake --build build-debug
ctest --test-dir build-debug --output-on-failure

cmake -S . -B build-asan -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer" \
  -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
cmake --build build-asan
ctest --test-dir build-asan --output-on-failure

cmake -S . -B build-ubsan -DCMAKE_BUILD_TYPE=RelWithDebInfo \
  -DCMAKE_CXX_FLAGS="-fsanitize=undefined -fno-omit-frame-pointer" \
  -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=undefined"
cmake --build build-ubsan
ctest --test-dir build-ubsan --output-on-failure

The sanitizer flags shown are supported by Clang and GCC. Other compilers may require different flags. Debug compilation and a feasible solver run currently expose the pre-existing defects tracked by issues #7 and #14 respectively; the test additions deliberately do not include fixes for those separate issues.