From 2fb0d1192d00a27e0870afd746a9c1b8689e5dff Mon Sep 17 00:00:00 2001 From: Tomasz Dwojak Date: Sat, 18 Nov 2017 00:19:40 +0100 Subject: [PATCH] Add test task --- labs02/test_task.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 labs02/test_task.py diff --git a/labs02/test_task.py b/labs02/test_task.py new file mode 100755 index 0000000..34858ae --- /dev/null +++ b/labs02/test_task.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + + +def suma(a, b): + """ + Napisz funkcję, która zwraca sumę elementów. + """ + pass + +def tests(f): + inputs = [(2, 3), (0, 0), (1, 1)] + outputs = [5, 0, 2] + + for input, output in zip(inputs, outputs): + if suma(*input) != output: + return "ERROR: {}!={}".format(suma(*input), output) + break + return "TESTS PASSED" + +if __name__ == "__main__": + print(tests(suma))