149 lines
5.1 KiB
Python
149 lines
5.1 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Test for ReCKoning project chain.
|
|
|
|
Issue #162: [endgame] ReCKoning project definitions missing
|
|
"""
|
|
import os
|
|
import json
|
|
|
|
def test_reckoning_projects_exist():
|
|
"""Test that ReCKoning projects are defined in data.js."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Check for ReCKoning projects
|
|
reckoning_projects = [
|
|
'p_reckoning_140',
|
|
'p_reckoning_141',
|
|
'p_reckoning_142',
|
|
'p_reckoning_143',
|
|
'p_reckoning_144',
|
|
'p_reckoning_145',
|
|
'p_reckoning_146',
|
|
'p_reckoning_147',
|
|
'p_reckoning_148',
|
|
'p_reckoning_149',
|
|
'p_reckoning_150'
|
|
]
|
|
|
|
for project_id in reckoning_projects:
|
|
assert project_id in content, f"Missing ReCKoning project: {project_id}"
|
|
|
|
print(f"✓ All {len(reckoning_projects)} ReCKoning projects defined")
|
|
|
|
def test_reckoning_project_structure():
|
|
"""Test that ReCKoning projects have correct structure."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Check for required fields
|
|
required_fields = ['id:', 'name:', 'desc:', 'cost:', 'trigger:', 'effect:']
|
|
|
|
for field in required_fields:
|
|
assert field in content, f"Missing required field: {field}"
|
|
|
|
print("✓ ReCKoning projects have correct structure")
|
|
|
|
def test_reckoning_trigger_conditions():
|
|
"""Test that ReCKoning projects have proper trigger conditions."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# First project should trigger on endgame conditions
|
|
assert 'p_reckoning_140' in content
|
|
assert 'totalRescues >= 100000' in content
|
|
assert 'pactFlag === 1' in content
|
|
assert 'harmony > 50' in content
|
|
|
|
print("✓ ReCKoning trigger conditions correct")
|
|
|
|
def test_reckoning_chain_progression():
|
|
"""Test that ReCKoning projects chain properly."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Check that projects chain (each requires previous)
|
|
chain_checks = [
|
|
('p_reckoning_141', 'p_reckoning_140'),
|
|
('p_reckoning_142', 'p_reckoning_141'),
|
|
('p_reckoning_143', 'p_reckoning_142'),
|
|
('p_reckoning_144', 'p_reckoning_143'),
|
|
('p_reckoning_145', 'p_reckoning_144'),
|
|
('p_reckoning_146', 'p_reckoning_145'),
|
|
('p_reckoning_147', 'p_reckoning_146'),
|
|
('p_reckoning_148', 'p_reckoning_147'),
|
|
('p_reckoning_149', 'p_reckoning_148'),
|
|
('p_reckoning_150', 'p_reckoning_149'),
|
|
]
|
|
|
|
for current, previous in chain_checks:
|
|
assert f"includes('{previous}')" in content, f"{current} doesn't chain from {previous}"
|
|
|
|
print("✓ ReCKoning projects chain correctly")
|
|
|
|
def test_reckoning_final_project():
|
|
"""Test that final ReCKoning project triggers ending."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Check that final project sets beaconEnding
|
|
assert 'p_reckoning_150' in content
|
|
assert 'beaconEnding = true' in content
|
|
assert 'running = false' in content
|
|
|
|
print("✓ Final ReCKoning project triggers ending")
|
|
|
|
def test_reckoning_costs_increase():
|
|
"""Test that ReCKoning project costs increase."""
|
|
data_path = os.path.join(os.path.dirname(__file__), '..', 'js', 'data.js')
|
|
|
|
with open(data_path, 'r') as f:
|
|
content = f.read()
|
|
|
|
# Check that costs increase (impact: 100000, 200000, 300000, etc.)
|
|
costs = []
|
|
for i in range(140, 151):
|
|
project_id = f'p_reckoning_{i}'
|
|
if project_id in content:
|
|
# Find cost line
|
|
lines = content.split('\n')
|
|
for line in lines:
|
|
if project_id in line:
|
|
# Find next few lines for cost
|
|
idx = lines.index(line)
|
|
for j in range(idx, min(idx+10, len(lines))):
|
|
if 'impact:' in lines[j]:
|
|
# Extract number from "impact: 100000" or "impact: 100000 }"
|
|
import re
|
|
match = re.search(r'impact:\s*(\d+)', lines[j])
|
|
if match:
|
|
costs.append(int(match.group(1)))
|
|
break
|
|
|
|
# Check costs increase
|
|
for i in range(1, len(costs)):
|
|
assert costs[i] > costs[i-1], f"Cost doesn't increase: {costs[i]} <= {costs[i-1]}"
|
|
|
|
print(f"✓ ReCKoning costs increase: {costs[:3]}...{costs[-3:]}")
|
|
|
|
if __name__ == "__main__":
|
|
print("Testing ReCKoning project chain...")
|
|
test_reckoning_projects_exist()
|
|
test_reckoning_project_structure()
|
|
test_reckoning_trigger_conditions()
|
|
test_reckoning_chain_progression()
|
|
test_reckoning_final_project()
|
|
test_reckoning_costs_increase()
|
|
print("\n✓ All tests passed!")
|