diff options
author | Jovina | 2011-08-10 15:27:14 +0530 |
---|---|---|
committer | Jovina | 2011-08-10 15:27:14 +0530 |
commit | 0ccad28c7dae7aa8b7467031afbcdf4ef6b2dbd0 (patch) | |
tree | 672585aa629bd1b880b0a4abe91d9df361d25dfe /testing_and_debugging/slides.org | |
parent | 4abbf4da1b5ce9027db4529eeac074bc2051ebbd (diff) | |
download | st-scripts-0ccad28c7dae7aa8b7467031afbcdf4ef6b2dbd0.tar.gz st-scripts-0ccad28c7dae7aa8b7467031afbcdf4ef6b2dbd0.tar.bz2 st-scripts-0ccad28c7dae7aa8b7467031afbcdf4ef6b2dbd0.zip |
Small changes to script & slides of 'testing and debugging'.
Diffstat (limited to 'testing_and_debugging/slides.org')
-rw-r--r-- | testing_and_debugging/slides.org | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing_and_debugging/slides.org b/testing_and_debugging/slides.org index cd0e32b..cb5f7ff 100644 --- a/testing_and_debugging/slides.org +++ b/testing_and_debugging/slides.org @@ -93,6 +93,19 @@ if \_\_name\_\_ == '\_\_main\_\_': | 12 | 28 | 4 | | 18 | 36 | 18 | | 4678 | 39763 | 2339 | +* Code piece +#+begin_src python +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 +#+end_src * Exercise 2 - For the same inputs as gcd write automated tests for LCM. * Solution 2 |