mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-24 17:05:03 +00:00
fix: Improve Countdown game expression generation and validation
This commit is contained in:
parent
1116f981c4
commit
9a9c2b0460
2 changed files with 26 additions and 8 deletions
|
|
@ -61,6 +61,14 @@ def test_countdown_game_items():
|
|||
|
||||
# Verify all numbers are within config range
|
||||
assert all(config.min_value <= n <= config.max_value for n in item["metadata"]["numbers"])
|
||||
|
||||
# Verify expression evaluates correctly
|
||||
expr = item["metadata"]["expression"]
|
||||
try:
|
||||
result = eval(expr) # Safe here since we control expression generation
|
||||
assert result == item["metadata"]["target"]
|
||||
except (SyntaxError, ZeroDivisionError):
|
||||
pytest.fail(f"Invalid expression generated: {expr}")
|
||||
|
||||
|
||||
def test_countdown_game_randomization():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue