28 lines
920 B
Python
28 lines
920 B
Python
from idea76_gameeconomy_studio_verifiable.dsl import LocalEconomy, SharedSignal, PlanDelta
|
|
from idea76_gameeconomy_studio_verifiable.core import EconomyEngine
|
|
|
|
|
|
def test_two_shards_deterministic_backtest():
|
|
shard1 = LocalEconomy(
|
|
name="Shard1",
|
|
currencies=["COIN"],
|
|
items=["Shield"],
|
|
budgets={"inflation_cap": 0.03},
|
|
)
|
|
shard2 = LocalEconomy(
|
|
name="Shard2",
|
|
currencies=["COIN"],
|
|
items=["Bow"],
|
|
budgets={"inflation_cap": 0.04},
|
|
)
|
|
|
|
engine = EconomyEngine([shard1, shard2])
|
|
delta = PlanDelta(round_id=1, changes={"currency:COIN": 50})
|
|
signals = [SharedSignal("Shard1", "liquidity", 0.6, 1), SharedSignal("Shard2", "liquidity", 0.7, 1)]
|
|
|
|
ir = engine.simulate_round(signals, delta)
|
|
|
|
assert "Shard1" in ir and "Shard2" in ir
|
|
assert ir["Shard1"]["currencies"]["COIN"] >= 0
|
|
assert ir["Shard2"]["currencies"]["COIN"] >= 0
|