Files
troupe-standup/wizard-work/spark/run_verification.py
T

34 lines
1.1 KiB
Python

#!/usr/bin/env python3
"""Verify Fibonacci output is correct."""
import sys
# Read verification file
with open('/root/.hermes/wizard-outputs/spark/final_verification.txt', 'r') as f:
data = f.read()
# Check all conditions
checks = [
'Match: True' in data,
'Sum correct: True' in data,
'ALL VERIFICATIONS PASS: True' in data
]
all_passed = all(checks)
# Also verify fibonacci_output.txt has correct sequence
expected = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]
with open('/root/.hermes/wizard-outputs/spark/fibonacci_output.txt', 'r') as f:
lines = f.readlines()[1:]
parsed = [int(line.strip().split(': ')[1]) for line in lines if ': ' in line]
seq_match = parsed == expected
sum_match = sum(parsed) == 10945
last_match = parsed[-1] == 4181
# Report
print(f"Sequence match: {seq_match}")
print(f"Sum match: {sum_match}")
print(f"Last number match: {last_match}")
print(f"ALL PASSED: {all_passed and seq_match and sum_match and last_match}")
sys.exit(0 if (all_passed and seq_match and sum_match and last_match) else 1)