Commit graph Aetheria/tests/Aetheria.Shared.Tests/MiningCut2Tests.cs
Author SHA1 Message Date
Meta Vens
daa645601a Cut 2 Stryker fix batch: chunk-index bounds, respawn boundary, ChunkId equality
Stryker over Zone.cs (concurrency 1, 111 mutants tested) surfaced four real
gaps on this cut's own lines, all now killed:

- ChunkExists's range check (`index < 0 || index >= length`) survived both an
  AND weakening and a `>` boundary weakening, because nothing tried an
  out-of-range index on either side alone.
- The broken-until comparisons in ChunkExists/ChunkRadius and the pack-time
  pruning in IsExpired all survived a `>`/`<` vs `>=`/`<=` boundary flip,
  because every prior test advanced zone time well past BrokenUntil instead
  of landing on it exactly.
- ChunkId.Equals survived an AND-to-OR weakening: the wear dictionary's own
  GetHashCode already separates same-field/different-index and
  same-index/different-field pairs into different buckets, so a bad Equals
  was never reached through a lookup. Testing equality directly closes that.

Two survivors on this cut's lines are recorded as equivalent, not chased:
ChunkRadius's `wear.Damage <= 0f` boundary (at damage == 0, DamagedSize and
UndamagedSize evaluate the same curve at the same point, so no input
distinguishes the two branches), and ChunkId.GetHashCode's exact formula (a
hashcode's bit pattern isn't a contract; any deterministic function of the
same two fields trivially keeps equal keys hashing equal, and this
dictionary is too small for distribution to matter).

The remaining survivors (lines 44, 75, 170, 200, 212, 216, 319, 336-412) sit
in Update/GetOrbitPosition/GetSecurityLevel/GetHeight/GetNormal/PowerPulse,
none of which this cut touches; they predate it and are out of scope here.

Mutation score 38.62% -> 42.33% (78/111 killed, 2 timeout, 31 survived, all
31 either pre-existing or one of the two equivalents above).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 12:05:47 +02:00
Meta Vens
c924bae0dc Cut 2: tests for chunk wear's accumulation, break, respawn and persistence
Fixtures use two belts of distinct sizes and authored-shape hitpoints/
respawn curves, exercised over uneven time steps, never the flat default
curves that would hide a broken formula.

Pins: damage accumulates and shrinks the chunk before it breaks; the break
threshold is strictly greater-than (equal-to-hitpoints does not break);
respawn is a comparison against zone time, reached through uneven dt steps;
a chunk broken, respawned, and damaged again starts from zero rather than
leaking stale wear; wear does not cross-talk between chunks that share a
field or an index; wear round-trips through PackZone/Zone(pack); a healed,
non-broken entry is pruned from the pack; and a record built as raw
MessagePack bytes with only the six pre-Cut-2 keys (not a default-
constructed ZonePack) deserializes with ChunkWear == null and loads with no
wear, per the nullable-key-6 persistence rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-25 11:31:22 +02:00