From ebfc80546a4ebb31a7c0190eb3ef12e8fe06ac2e Mon Sep 17 00:00:00 2001 From: Codex instance Date: Thu, 30 Jul 2026 16:43:50 +0100 Subject: [PATCH] results: fix Debug rendering assertion Check the character in the output string instead of referring to a nonexistent grid_ member. This restores Debug compilation while preserving the intended invariant that rendering must not write an identical character twice. Size labels intentionally replace interior spaces, so requiring an entirely unwritten destination would reject valid solutions. Update the testing notes now that Debug builds pass. Tests: Debug and Release CTest suites (4 passed each) Refs: #7 --- TESTING.md | 6 +++--- main.cc | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/TESTING.md b/TESTING.md index 997bd28..2f5bc97 100644 --- a/TESTING.md +++ b/TESTING.md @@ -38,6 +38,6 @@ 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. +require different flags. A feasible solver run currently exposes the +pre-existing defect tracked by issue #14; the test additions deliberately do +not include its separate fix. diff --git a/main.cc b/main.cc index ee2c9bd..c71cae1 100644 --- a/main.cc +++ b/main.cc @@ -85,7 +85,8 @@ namespace { auto set(std::string &s, size_t x, size_t y, char c) const noexcept -> void { assert(x < length_); assert(y < length_); - assert(grid_[x + y * length_] != c); + // Size labels may replace interior spaces, but must not duplicate a write. + assert(s[x + y * length_] != c); s[x + y * length_] = c; }