Repository navigation
Add tests for the documented error paths - #66
Merged
Merged
Conversation
Characterize the runtime_error throws listed in README's Errors section: getFirstEntity on an empty environment, getEntity on an unknown id (including the found-ids message), Grid::getLocation and getLocationByCoordinates with no match, and moveEntityToNewLocation / directional moves with an unknown entity or location id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (anchor: CI "Library tests (make + CMake)" job, run 40826748536, where Tests 1–52 each printed
Observation: This review was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Stage B (unit-test expansion) cycle. No open issues existed at triage, so the cycle was spent on test coverage. README's
## Errorssection documents severalstd::runtime_errorthrow paths, and before this PR no test insrc/tests.cppexercised any of them (there was notry/catchanywhere in the suite).Five characterization tests are added to
src/tests.cppand registered inmain():Environment::getFirstEntitythrows on an empty environment.Environment::getEntitythrows for an unknown id, and the message names the requested id, the environment, and the ids that were found (found: 3,).Grid::getLocationandGrid::getLocationByCoordinatesthrow when nothing matches (including an off-grid coordinate).Environment::moveEntityToNewLocationwith an unknown location id throws and leaves the entity's ids, placement and the entity count unchanged.moveEntityToNewLocationand a directional move (moveEntityUp) throw for an entity id that is not in the environment.The tests assert the current behaviour only. No production code is changed, and each assertion was checked against
src/environment.cppandsrc/grid.cppbefore it was written.<stdexcept>is now included directly insrc/tests.cpp.No tracking issue: the coverage gap was found during triage.
Test plan
makecompiles cleanly locallyrun_tests.shand every test through Test 52 prints--- Success(local execution oftests_executableis denied in this sandbox, so CI is the anchor)This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson