23 lines
779 B
Python
23 lines
779 B
Python
def simulate_calculate_rate(executions, failures):
|
|
if executions == 0:
|
|
return 0
|
|
return (failures / executions) * 100
|
|
|
|
if __name__ == "__main__":
|
|
print("--- Test 1: Healthy Skill ---")
|
|
r1 = simulate_calculate_rate(100, 2)
|
|
print(f"Rate: {r1}%")
|
|
status1 = "PASS" if r1 == 2.0 else "FAIL"
|
|
|
|
print("\n--- Test 2: Failing Skill (Threshold Breach) ---")
|
|
r2 = simulate_calculate_rate(50, 25)
|
|
print(f"Rate: {r2}%")
|
|
status2 = "PASS" if r2 == 50.0 else "FAIL"
|
|
|
|
print("\n--- Test 3: Zero Execution Grace ---")
|
|
r3 = simulate_calculate_rate(0, 0)
|
|
print(f"Rate: {r3}%")
|
|
status3 = "PASS" if r3 == 0 else "FAIL"
|
|
|
|
print(f"\nFinal Status: {'PASS' if all(s == 'PASS' for s in [status1, status2, status3]) else 'FAIL'}")
|