Repository navigation
Add tests pinning entity identity and duplicate-add behaviour - #69
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric:
Judgment note: src/tests.cpp (Test 58) — the test intentionally leaves the location ids unasserted after removal through a same-id twin. Test-only, anchor green, no do-not-auto-merge paths touched; ready to merge. 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. The README's "Entity Identity" section describes three behaviours that no test pinned; three characterization tests are added to
src/tests.cppand registered inmain():testPlacingAndRemovingEntityResetsAllIds: a new entity starts with environment id-1, grid id-1and location id"N/S"; placing it through anEnvironmentsets all three, andEnvironment::removeEntityresets all three. (The existing tests checked only the environment id on removal and never checked the"N/S"default of a freshly constructed entity.)testEntitiesSharingAnIdAreMatchedAsTheSameEntity: a distinctEntityobject sharing an id is reported present byLocation/Environment::isEntityPresent,getEntityreturns the originally placed object, andLocation::removeEntitycalled with the twin removes the original's pointer.testAddingEntityTwiceStoresItTwice: adding the same entity twice stores two pointers,getNumEntitiescounts each, and the location id names only the most recent location.No production code is changed. No open issues existed at triage, so no issue is closed and none was deferred.
Observation, not changed here: when an entity is removed through a same-id twin,
Location::removeEntityresets the twin's location id, while the stored original keeps its stale location id. Test 58 deliberately does not assert either object's location id after that removal, so the quirk is not pinned.Test plan
makecompiles cleanly locallytests_executableis not permitted in this environment, so CI is the anchor)No tracking issue — gap found during triage.
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