35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Final verification of Fibonacci output files."""
|
|
|
|
# Expected Fibonacci sequence (first 20)
|
|
expected = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, 4181]
|
|
|
|
# Read and parse fibonacci_output.txt
|
|
with open("/root/.hermes/wizard-outputs/spark/fibonacci_output.txt", "r") as f:
|
|
lines = f.readlines()[1:] # Skip header
|
|
parsed = []
|
|
for line in lines:
|
|
parts = line.strip().split(": ")
|
|
if len(parts) == 2:
|
|
parsed.append(int(parts[1]))
|
|
|
|
# Check 1: Correct sequence
|
|
check1 = parsed == expected
|
|
|
|
# Check 2: Sum is correct
|
|
check2 = sum(parsed) == 10945
|
|
|
|
# Check 3: Last number is correct
|
|
check3 = parsed[-1] == 4181
|
|
|
|
# Write final verdict
|
|
with open("/root/.hermes/wizard-outputs/spark/final_verification.txt", "w") as f:
|
|
f.write("=== FINAL VERIFICATION ===\n")
|
|
f.write(f"Expected sequence: {expected}\n")
|
|
f.write(f"Parsed sequence: {parsed}\n")
|
|
f.write(f"Match: {check1}\n")
|
|
f.write(f"Sum correct: {check2}\n")
|
|
f.write(f"Last number correct: {check3}\n")
|
|
f.write(f"ALL VERIFICATIONS PASS: {check1 and check2 and check3}\n")
|
|
|
|
print("=== FINAL VERIFICATION PASSED ===" if (check1 and check2 and check3) else "=== VERIFICATION FAILED ===") |