summaryrefslogtreecommitdiff
path: root/testing_and_debugging/gcd.py
blob: 7cbb9a0f1d7bb2dd8275b0c89f3b9e80299eb040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def gcd(a, b):
    if b==0:
       return a
    return gcd(b, a%b)

#if __name__ == '__main__':
#     result = gcd(48, 64)
#     if result!= 16:
#         print "Test failed"
#     print "Test Passed"



#if __name__ == '__main__':
#    for line in open('testcases.txt'):
#        numbers = line.split()
#        x = int(numbers[0])
#        y = int(numbers[1])
#        result = int(numbers[2])
#       	if gcd(x, y) != result:
#            print "Failed gcd test for", x, y
#        else:
#            print "Test passed" , result