Repository navigation
test(joints): read what a joint's kind does not carry - #358
Merged
Merged
Conversation
siracozmen01
commented
Nov 5, 2026
siracozmen01
left a comment
Collaborator
Author
There was a problem hiding this comment.
Review at 4a5662a: no change needed. I read the code; I did not run it. Checks were still pending when I read them.
Each read matches what include/maul2d/joint.h documents for a joint of the wrong kind:
m2Joint_GetSpringHertzon a filter joint (joint.h:818-827). The filter joint is not in its list (distance, wheel, revolute, motor, mouse). It returns 0 and counts one misuse.m2Joint_GetConstraintHertzon a distance joint (796-805). The distance joint is not in its list (revolute, prismatic, gear, pulley, ratchet). It returns 0 and counts one misuse.m2WeldJoint_GetLinearSpringHertzon a revolute joint (840-849). It returns 0 and counts one misuse.m2Joint_GetLocalAxisAon a revolute joint. Its own comment (786-794) promises only zero and says nothing about a misuse. The count the test asserts comes from the file comment at joint.h:7-9: a call made for one joint type "does the same" on another type, meaning it changes nothing, returns zero and counts one misuse. Somisuse + 4is what the header promises as a whole. The function comment could say the misuse as the tuning readers' comments do, but that is not needed for this change.- The near miss is valid. The revolute joint is in
m2Joint_GetSpringHertz's list. The baseline is taken afterm2Joint_SetSpringHertz, so the setter cannot shift the count. The final check also asserts the count did not move.
The body has Problem, Change and Verification. No line starts at column 0 with a word( or type(scope):.
siracozmen01
added a commit
that referenced
this pull request
Nov 5, 2026
## Problem The pair table's merge overflow in `m2UpdatePairs` is reachable from the public API, and no test takes it. It happens when pairs kept from earlier steps plus new candidates run past the table. Its drops are counted in `m2Counters.pairsDropped`, but only the collection's drop is tested, so a change that lost the merge's pairs silently would pass every suite. `m2Joint_GetLocalAxisA`'s `@return` also leaves out the misuse its refusals count (#359). ## Change - `test/test_broadphase.c` gains `TestFullTableMergeIsCounted`. The world has no gravity and 24 dynamic discs on one spot with every motion lock set. They want 276 pairs, and a world of 24 shapes keeps 192. - The first step keeps 192 pairs and counts the other 84. - A second step, with nothing moving, keeps the 192 and drops nothing. - One disc is teleported 1 mm. Locked, the other discs never leave their fat boxes, so only it meets its 23 neighbors again. The 23 candidates fit the candidate scratch, so every pair lost now is lost in the merge into the full table. The step keeps 192, and counts between 1 and 23. - `include/maul2d/joint.h`: `m2Joint_GetLocalAxisA`'s `@return` says that another joint type or a stale id reads zero and counts one misuse, as #358 tests. No result changes: the code is as it was. ## Verification - `test_broadphase` passes. - Mutants, each built into a scratch library and run against `test_broadphase`: | Mutant | Fails | |---|---| | the merge drops a pair without counting it | the teleport step's count | | the collection drops pairs without counting them | the first step's count, and `TestFullPairTableIsCounted` | - `tools/check.sh changed` passes, the documentation check included. The changed files compile clean with gcc-14 and clang-20 under the strict flags. - `test_golden` prints the 13 lines of `test/hashes.txt` unchanged in the scalar (`linux-clang-20-asan`) and AVX2 (`linux-clang-20`) presets. Closes #359
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.
Problem
No test asks
m2Joint_GetLocalAxisAfor the axis of a joint that has none, or a tuning reader for a tuning the joint's kind does not carry. Their headers promise zero, and the tuning readers one misuse, but a change to either refusal would pass every suite (#357).Change
test/test_joints.cgainsTestJointReadersCheckTheKind:m2Joint_GetLocalAxisA);m2Joint_GetSpringHertz);m2Joint_GetConstraintHertz);m2WeldJoint_GetLinearSpringHertz).A test-only change.
Verification
test_jointspasses.test_joints:tools/check.sh changedpasses. The changed file compiles clean with gcc-14 and clang-20 under the strict flags.test_goldenprints the 13 lines oftest/hashes.txtunchanged in the scalar (linux-clang-20-asan) and AVX2 (linux-clang-20) presets.Closes #357