Repository navigation
Pin size-zero environments and moves onto the current location - #82
Merged
dmccoystephenson merged 1 commit intoNov 12, 2026
Merged
Conversation
Characterization tests for two untested boundaries: an environment of size 0 has no locations, its id/coordinate/entity lookups throw, and addEntityToLocation places nothing; moving an entity to the location it is already in leaves exactly one pointer there with its ids intact. README's Errors section now says which lookups stay safe on an empty grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (anchored on CI run 43173835568, where Tests 82 and 83 print
Minor observation (not blocking): src/tests.cpp, Test 82, does not assert that the entity's location id stays This review comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
dmccoystephenson
deleted the
feature/test-empty-grid-and-same-location-move
branch
November 12, 2026 07:18
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
testEnvironmentOfSizeZeroHasNoLocationsAndLookupsThrow(Test 82) is added. AnEnvironmentof size 0 is shown to have no locations and zero entities.Grid::getLocation,Grid::getLocationByCoordinates,Environment::getFirstEntity, andEnvironment::getEntityare shown to throwstd::runtime_erroron it.addEntityToLocationwith a separately constructedLocation("0-0-0", 0, 0)is shown to place nothing and leave the entity's environment id and grid id at-1, andprintConsoleRepresentation()is shown to print only a newline.testMovingEntityToItsCurrentLocationLeavesItThere(Test 83) is added.moveEntityToNewLocationonto the entity's own location is shown to leave exactly one pointer (the entity's address) in that location, with its location, environment, and grid ids intact.getFirstLocation/getRandomLocationare undefined behaviour there.This is a Stage B (unit-test expansion) cycle. Both tests describe current behaviour, and no production code is changed. Before this PR, neither a size-0 environment nor a same-location move had any test. No open issues existed at triage, so no skip reasons apply.
No tracking issue: the gap was found during triage.
Test plan
makecompiles cleanly with the new tests (checked locally).bash run_tests.shandrun_tests_asan.shwere not run locally, because running the test binary is denied in this sandbox. CI'sLibrary tests (make + CMake)job is the anchor, and the merge waits on it.main().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