diff options
author | Madhusudan.C.S | 2010-08-31 20:14:18 +0530 |
---|---|---|
committer | Madhusudan.C.S | 2010-08-31 20:14:18 +0530 |
commit | 837f3192a27b8367ff55d98865029947e7db9a50 (patch) | |
tree | 9ede02f1677d710c5c0b5ed2514db34b46856426 /tdd | |
parent | 0ad5bac2a7c61a46feeac4b1bddc4cb4ba66e8b0 (diff) | |
download | sees-837f3192a27b8367ff55d98865029947e7db9a50.tar.gz sees-837f3192a27b8367ff55d98865029947e7db9a50.tar.bz2 sees-837f3192a27b8367ff55d98865029947e7db9a50.zip |
Manipulated the python gcd script to accommodate new way of testing.
Diffstat (limited to 'tdd')
-rw-r--r-- | tdd/gcd.py | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -4,14 +4,15 @@ def gcd(a, b): return a if __name__ == '__main__': - tc1 = gcd(48, 64) - if tc1 != 16: - print "Test failed for the case a=48 and b=64. Expected 16. Obtained %d instead." % tc1 - exit(1) + for line in open('gcd_testcases.dat'): + values = line.split(', ') + a = int(values[0]) + b = int(values[1]) + g = int(values[2]) - tc2 = gcd(44, 19) - if tc2 != 1: - print "Test failed for the case a=44 and b=19. Expected 1. Obtained %d instead." % tc2 - exit(1) + tc = gcd(a, b) + if tc != g: + print "Test failed for the case a=%d and b=%d. Expected %d. Obtained %d instead." % (a, b, g, tc) + exit(1) print "All tests passed!" |