This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
kse-02/instrumented/gcd.py

16 lines
419 B
Python

def gcd_instrumented(a: int, b: int) -> int:
assert ((a > 0) and (b > 0))
if (evaluate_condition(1, 'Eq', a, 1) or evaluate_condition(2, 'Eq', b, 1)):
return 1
if evaluate_condition(3, 'Eq', a, b):
return a
if evaluate_condition(4, 'Gt', b, a):
(a, b) = (b, a)
while evaluate_condition(5, 'NotEq', b, 0):
temp = b
b = (a % b)
a = temp
return a