Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create files to use in demo #255

Merged
merged 1 commit into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions presentaties/demo/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#! /usr/bin/env sh

python test.py
2 changes: 2 additions & 0 deletions presentaties/demo/submission/correct/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def sum(a, b):
return a + b
2 changes: 2 additions & 0 deletions presentaties/demo/submission/wrong/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def sum(a, b):
return a - b
37 changes: 37 additions & 0 deletions presentaties/demo/test.py
Original file line number Diff line number Diff line change
@@ -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()
Empty file added presentaties/demo/verslag.docx
Empty file.
Empty file added presentaties/demo/verslag.pdf
Empty file.
Loading