idea81-audioledger-studio-v.../tests/test_runtime.py

13 lines
489 B
Python

from idea81_audioledger_studio_verifiable.runtime import ExecutionGraph
def test_runtime_allocation_scaling():
g = ExecutionGraph()
assets = {"A": 100.0, "B": 300.0}
g.compile_from_ir({"objects": type("O", (), {"assets": assets})()})
result = g.run(assets, target_total=400.0)
# Ratios preserved, sum equals target
assert abs(sum(result.values()) - 400.0) < 1e-6
assert result["A"] == 100.0 * (400.0 / 400.0)
assert result["B"] == 300.0 * (400.0 / 400.0)