25 lines
881 B
Python
25 lines
881 B
Python
import pytest
|
|
|
|
from idea76_gameeconomy_studio_verifiable.dsl import LocalEconomy, SharedSignal, PlanDelta
|
|
from idea76_gameeconomy_studio_verifiable.core import EconomyEngine
|
|
|
|
|
|
def test_inflation_cap_and_delta_application():
|
|
le = LocalEconomy(
|
|
name="ShardA",
|
|
currencies=["GEM"],
|
|
items=["Sword"],
|
|
budgets={"inflation_cap": 0.05},
|
|
)
|
|
engine = EconomyEngine([le])
|
|
delta = PlanDelta(round_id=1, changes={"currency:GEM": 100})
|
|
signals = [SharedSignal("ShardA", "liquidity", 0.8, 1)]
|
|
|
|
ir = engine.simulate_round(signals, delta)
|
|
|
|
assert "ShardA" in ir
|
|
shard = ir["ShardA"]
|
|
assert shard["currencies"]["GEM"] >= 0
|
|
# Ensure that the delta applied increased the GEM amount by approximately the delta (subject to cap)
|
|
assert shard["currencies"]["GEM"] <= 1000 + 100 # cap logic in MVP is loose; keep bounds reasonable
|