aboutsummaryrefslogtreecommitdiff
path: root/internal/game/economy_reanchor_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/economy_reanchor_test.go')
-rw-r--r--internal/game/economy_reanchor_test.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/internal/game/economy_reanchor_test.go b/internal/game/economy_reanchor_test.go
deleted file mode 100644
index 86d7bf1..0000000
--- a/internal/game/economy_reanchor_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package game
-
-import (
- "testing"
-
- "thehouseoficarus/internal/casino"
-)
-
-// TestReanchorOwedPayoutReadsAsOwed: when recovery cannot pay every sibling in
-// an identical-signature payout group, the unpaid remainder must be re-anchored
-// to the current durable balance. Otherwise a later run (after compaction drops
-// the settled sibling evidence) reads the balance as the record's own
-// durability and settles the liability without paying it.
-func TestReanchorOwedPayoutReadsAsOwed(t *testing.T) {
- rec := &economyRecord{Credit: 20, CreditsBefore: 90, CreditsAfter: 110}
- // One sibling was paid: the durable balance now sits at 110.
- reanchorOwedPayout(rec, 110, rec.Credit)
- if rec.CreditsBefore != 110 || rec.CreditsAfter != 130 {
- t.Fatalf("re-anchored checkpoints = before %d after %d, want before 110 after 130", rec.CreditsBefore, rec.CreditsAfter)
- }
-
- // At the economy cap the post-checkpoint must stay reachable: before ==
- // after so the record keeps reading as owed instead of claiming an
- // impossible balance that a coincidental balance could be mistaken for.
- capped := &economyRecord{Credit: 20}
- reanchorOwedPayout(capped, casino.MaxCredits, capped.Credit)
- if capped.CreditsBefore != casino.MaxCredits || capped.CreditsAfter != casino.MaxCredits {
- t.Fatalf("cap re-anchor = before %d after %d, want both %d",
- capped.CreditsBefore, capped.CreditsAfter, casino.MaxCredits)
- }
-}