#!/usr/bin/env python3 """Fibonacci number verification - concrete testable artifact.""" def fib(n: int) -> int: """Compute the nth Fibonacci number.""" if n <= 0: return 0 if n == 1: return 1 a, b = 0, 1 for _ in range(2, n + 1): a, b = b, a + b return b def verify_fibs(): """Verify known Fibonacci numbers.""" # Known Fibonacci values expected = { 0: 0, 1: 1, 2: 1, 3: 2, 4: 3, 5: 5, 6: 8, 7: 13, 8: 21, 9: 34, 10: 55, 15: 610, 20: 6765, } errors = [] for n, expected_val in expected.items(): actual = fib(n) if actual != expected_val: errors.append(f"fib({n}) = {actual}, expected {expected_val}") if errors: for e in errors: print(f"ERROR: {e}") return False print("All Fibonacci verifications passed") return True if __name__ == "__main__": import sys success = verify_fibs() sys.exit(0 if success else 1)