Commit graph Aetheria/tests/Aetheria.Shared.Tests/PowerTierTests.cs
Author SHA1 Message Date
Meta Vens
0b721d691f Tests: the VerseGrammar global replaces TestCatalogGlobal as the catalog global fixtures author
TestCatalogGlobal existed only to give the test host one [CultGlobal] routed to the catalog. VerseGrammar is the
game's first, so the test-only type is deleted and every fixture authors a VerseGrammar instead (63 call sites; the
missing-global tests assert on aetheria.verse_grammar). Stale comments about the test type are rewritten.
Builds (not yet run when committed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-10 07:18:00 +02:00
Meta Vens
f36effd70b F3: an empty tier is not a satisfied tier, and sub-epsilon demand pays its way
AllocateTiers treated any tier whose summed demand was at or below 1e-4 as
"fully met" (ratio 1) without ever subtracting it from `remaining`. Two bugs:
a tier with no consumers equipped in it at all read as 1f, the exact "fully
supplied" signal a UI is meant to trust, even on a fully blacked-out ship
(measured: Critical 0 demand reads "fine" right next to a genuinely starved
High); and a tier with a real but tiny demand (down to 5e-5) was granted out
of nothing and never charged against the ship's actual generation, letting a
lower tier get overfed by the sliver the higher one was never billed for.

AllocateTiers now tracks which tiers actually have a consumer separately from
their summed demand. A tier with no consumer reports the new PowerBus.NoDemand
sentinel (NaN), never 1f. A tier with a consumer whose own request truly is
zero this tick is trivially satisfied (ratio 1, nothing to be short of). Any
other demand, however small, goes through the same grant/remaining arithmetic
as every other tier.

Pinned in tests/Aetheria.Shared.Tests/PowerTierTests.cs:
SubEpsilonDemandGetsNoGrantAtTotalBlackout,
HigherTierSubEpsilonDemandIsStillSubtractedFromRemaining, and
EmptyTierAtBlackoutReportsNoDemandNotFullySupplied -- all fail under the
reverted (<=1e-4 free-pass) mutation. Updated
ATierWithNoDemandPassesItsShareDown's own empty-tier assertion, which had
pinned the bug itself ("empty tiers read as fully met").

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 05:15:30 +02:00
Meta Vens
d07652b5bb Pin Cut 5's tier rules: PowerTierTests.cs
Six tests against the "rules worth pinning" list: critical fed in full while
a lower tier starves; two consumers in one tier rationed proportionally to
their own request, not split evenly; an empty tier passes its share down
instead of swallowing it; reactor throttling moves the line between what
starves and what doesn't; a starved tier cannot leak into a lower one; and a
tier change on an equipped item takes effect on the very next tick with no
unequip/re-equip round trip.

103 -> 109 tests. Each rule has a matching mutation in
tests/mutation_tests_stats_power_cut5.py.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-19 02:58:47 +02:00