Skip to content

test: add coverage for clampHorizontalSpeed and projectDirectionOnPlane#3

Open
yassin-openclaw[bot] wants to merge 1 commit into
mainfrom
bot/codex-routing-test-1
Open

test: add coverage for clampHorizontalSpeed and projectDirectionOnPlane#3
yassin-openclaw[bot] wants to merge 1 commit into
mainfrom
bot/codex-routing-test-1

Conversation

@yassin-openclaw

Copy link
Copy Markdown

Summary

Adds test coverage for two previously untested pure utility functions in `MovementMath.ts`: `clampHorizontalSpeed` and `projectDirectionOnPlane`.

Changes

  • `src/movement/tests/MovementMath.test.ts` — added 7 new test cases across two new `describe` blocks

clampHorizontalSpeed (4 cases):

  • Speed already under limit → no modification
  • Speed over limit → clamped to max
  • Direction preserved after clamping
  • Zero vector → no division by zero

projectDirectionOnPlane (3 cases):

  • Normal case → result is unit length and perpendicular to plane normal
  • Direction parallel to normal → returns zero vector
  • Input vectors not mutated

Validation

```
npm test
✓ MovementMath.test.ts (10 tests)
✓ MovementBehavior.test.ts (3 tests)
✓ SurfCollisionWorld.test.ts (3 tests)
Tests: 16 passed (16)
```

Risks / Notes

  • Pure unit tests only; no production code changed
  • No new dependencies introduced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants