pdate
DevPlace CI / test (push) Has been cancelled

This commit is contained in:
2026-07-23 01:14:10 +02:00
parent 64c3983c9f
commit 582e37d176
24 changed files with 549 additions and 36 deletions
+64
View File
@@ -399,3 +399,67 @@ def test_weekly_contract_deterministic():
assert first == second
assert first["kind"] in economy.QUEST_DEFS
assert first["reward_stars"] > 0
# --- refactor fee, carry-over, and grants -------------------------------------------
def test_refactor_cost_monotonic_in_prestige():
previous = 0
for prestige in range(0, 200):
cost = economy.refactor_cost(prestige, 0)
assert cost > previous
previous = cost
def test_refactor_cost_monotonic_in_wealth():
previous = -1
for coins in range(0, 2_000_000, 10_000):
cost = economy.refactor_cost(0, coins)
assert cost >= previous
previous = cost
def test_refactor_cost_floor_is_base():
assert economy.refactor_cost(0, 0) == economy.REFACTOR_BASE_COST
assert economy.refactor_cost(-5, -100) == economy.REFACTOR_BASE_COST
def test_refactor_cost_includes_wealth_tax():
coins = 100_000
expected = round(
economy.REFACTOR_BASE_COST + economy.REFACTOR_WEALTH_PCT * coins
)
assert economy.refactor_cost(0, coins) == expected
def test_refactor_carryover_fraction_bounds():
for level in range(0, 50):
fraction = economy.refactor_carryover_fraction(level)
assert economy.REFACTOR_CARRYOVER_BASE <= fraction <= economy.REFACTOR_CARRYOVER_MAX
def test_refactor_carryover_never_exceeds_remainder():
for coins in range(0, 500_000, 7_777):
for level in (0, 3, 5):
fee = economy.refactor_cost(0, coins)
carried = economy.refactor_carryover(coins, fee, level)
assert 0 <= carried <= max(0, coins - fee)
def test_refactor_carryover_zero_when_unaffordable():
assert economy.refactor_carryover(100, 20_000, 5) == 0
def test_grant_amount_capped_and_bounded():
assert economy.grant_amount(0) == 0
assert economy.grant_amount(-10) == 0
assert economy.grant_amount(100) == 100
assert economy.grant_amount(10**9) == economy.GRANT_CAP
def test_legacy_carryover_upgrade_registered():
upgrade = economy.legacy_for("carryover")
assert upgrade is not None
assert upgrade.max_level == 5
assert "carry-over" in economy.legacy_value_text(upgrade, 2)