diff --git a/presentaties/demo/run b/presentaties/demo/run new file mode 100755 index 00000000..7eb088d6 --- /dev/null +++ b/presentaties/demo/run @@ -0,0 +1,3 @@ +#! /usr/bin/env sh + +python test.py diff --git a/presentaties/demo/submission/correct/main.py b/presentaties/demo/submission/correct/main.py new file mode 100644 index 00000000..91403275 --- /dev/null +++ b/presentaties/demo/submission/correct/main.py @@ -0,0 +1,2 @@ +def sum(a, b): + return a + b diff --git a/presentaties/demo/submission/wrong/main.py b/presentaties/demo/submission/wrong/main.py new file mode 100644 index 00000000..5023035e --- /dev/null +++ b/presentaties/demo/submission/wrong/main.py @@ -0,0 +1,2 @@ +def sum(a, b): + return a - b diff --git a/presentaties/demo/test.py b/presentaties/demo/test.py new file mode 100644 index 00000000..8c604d35 --- /dev/null +++ b/presentaties/demo/test.py @@ -0,0 +1,37 @@ +import os +from submission import main + +correct_path = os.environ["CORRECT"] +failed_path = os.environ["FAILED"] +failed_exit_code = int(os.environ["EXIT_TEST_FAILED"]) + +test_cases = [ + (0, 0, 0), + (1, 2, 3), + (3, 4, 7), + (5, 6, 11), + (7, 8, 15), + (9, 10, 19), + (11, 12, 23), + (13, 14, 27), + (15, 16, 31), + (17, 18, 35), + (19, 20, 39) +] + +def run_tests(): + has_failed = False + with open(correct_path, "w") as correct, open(failed_path, "w") as failed: + for test in test_cases: + a, b, expected = test + result = main.sum(a, b) + if result == expected: + correct.write(f"{a} {b} {expected}\n") + else: + failed.write(f"{a} {b} {expected}\n") + has_failed = True + if has_failed: + exit(failed_exit_code) + +if __name__ == "__main__": + run_tests() diff --git a/presentaties/demo/verslag.docx b/presentaties/demo/verslag.docx new file mode 100644 index 00000000..e69de29b diff --git a/presentaties/demo/verslag.pdf b/presentaties/demo/verslag.pdf new file mode 100644 index 00000000..e69de29b