Files
sporel-lib-core.camera-test/README.md
Axel Meyer 563c8e4ae7 docs(camera-test): Coverage Statements from fault-injection audit (Test-Cov Phase 2.4)
3 mutations tested. 3 caught, 0 uncaught.
Full coverage on tested surface: set_target axis-swap, clear_bounds no-op, bind_pan_keys auto-enable removal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 02:32:14 +02:00

39 lines
1.9 KiB
Markdown

# sporel-lib-core.camera-test
P.3.5 test-lib — validates `lib-core.camera` v0.3.0 API contracts (state setters,
bounds-clamping, pan_enabled toggle, pan_invert, engine-surface presence)
via the `engine.test.*` assertion surface. 16 assertions total.
- Lib-ID: `lib-core.camera-test`
- Version: `0.1.0`
- Kind: `test-lib` (headless; M.run_tests(ctx) invoked by engine test-runner)
- Spec: `meta/docs/superpowers/specs/2026-05-13-p3-5-camera-free-pan-design.md`
## Run
```bash
Sporel.exe --libs-dir=<libs-path> --test-libs=lib-core.camera-test
```
Output is TAP version 13 on stdout; exit-code = failure-count (0 = all pass).
## Coverage Statements (2026-05-16 Fault-Injection Audit)
Verified via deliberate-mutation in fixture-mirror; mutations reverted after observation.
### Caught Mutations
| # | Mutation | Caught by |
|---|---|---|
| M1 | `set_target`: x/y assignments swapped (`target_x = y; target_y = x`) | Assertions 1 ("set_target -> target", `t.x==100 and t.y==200`) and 4 ("set_target clamped to bounds") both fail |
| M2 | `clear_bounds` made no-op (`do return end` as first statement) | Assertion 5 ("clear_bounds -> unclamped") fails — target remains clamped after clear |
| M3 | `bind_pan_keys` auto-enable removed (`pan_enabled_v.keys = true` commented out) | Assertion 10 ("bind_pan_keys auto-enables") fails — `pan_enabled("keys")` returns false |
### Uncaught Mutations (Gaps)
None — all 3 mutations caught.
### Tested Production-Lib Surface
`lib-core.camera` v0.3.0 — Tests cover behavior of: `camera.set_target`/`target` (value + bounds-clamping), `camera.set_zoom`/`zoom`, `camera.set_pan_speed`/`pan_speed`, `camera.set_bounds`, `camera.clear_bounds`, `camera.bind_pan_keys` (auto-enable side-effect), `camera.set_pan_enabled`/`pan_enabled` (toggle false/true), `camera.set_pan_invert`/`pan_invert`. Engine surface: `engine.input.get_mouse_delta`, `engine.window.size` function presence.