test: cover completed solver boards

Exercise both the trivial order-1 solution and the feasible order-8 solution through the independent placement validator.

With the existing completion ordering, the focused test reports a heap-buffer-overflow under AddressSanitizer before validation can run.

Refs: #14
This commit is contained in:
Codex instance
2026-07-30 16:49:21 +01:00
parent ebfc80546a
commit ccdcf03fa8
2 changed files with 17 additions and 0 deletions
+1
View File
@@ -15,4 +15,5 @@ if(BUILD_TESTING)
add_test(NAME construction COMMAND partridge_tests construction) add_test(NAME construction COMMAND partridge_tests construction)
add_test(NAME rendering COMMAND partridge_tests rendering) add_test(NAME rendering COMMAND partridge_tests rendering)
add_test(NAME solver-small COMMAND partridge_tests solver-small) add_test(NAME solver-small COMMAND partridge_tests solver-small)
add_test(NAME solver-completion COMMAND partridge_tests solver-completion)
endif() endif()
+16
View File
@@ -280,6 +280,19 @@ namespace {
"result adapter did not convert encoded placement coordinates"); "result adapter did not convert encoded placement coordinates");
return failures; return failures;
} }
auto test_solver_completion() -> int {
int failures = 0;
for (auto const order: std::array<std::uint64_t, 2>{1, 8}) {
auto const solution = find_solution(order);
auto const validation = validate(order, solution);
failures += expect(
validation.valid(),
"solver returned an invalid order-" + std::to_string(order) +
" solution:\n" + validation.text());
}
return failures;
}
} }
int main(int argc, char **argv) { int main(int argc, char **argv) {
@@ -301,6 +314,9 @@ int main(int argc, char **argv) {
if (test == "solver-small") { if (test == "solver-small") {
return test_small_solver(); return test_small_solver();
} }
if (test == "solver-completion") {
return test_solver_completion();
}
std::cerr << "unknown test: " << test << '\n'; std::cerr << "unknown test: " << test << '\n';
return 2; return 2;
} }