diff --git a/ifj2017/test/loader.py b/ifj2017/test/loader.py index ca90503..e8dcdd9 100644 --- a/ifj2017/test/loader.py +++ b/ifj2017/test/loader.py @@ -60,8 +60,20 @@ def _load_compact_tests(self, section_dir): extensions = tuple(data.get('extensions', ())) try: for i, test_case in enumerate(data.get('tests', ())): - name = test_case.get('name') or '{:03}'.format(i + 1) - code = test_case.get('code') or self._load_test_file(section_dir, name, 'code') + name = test_case.get('name') + code = test_case.get('code') + + if name and code: + TestLogger.log_warning( + "Redefined test {} in file {}, skipping.".format(name, path.join(section_dir, 'tests.json')) + ) + continue + + if not name: + name = '{:03}'.format(i + 1) + + if not code: + code = self._load_test_file(section_dir, name, 'code') cases.append( TestInfo( diff --git a/ifj2017/tests/01_basic/tests.json b/ifj2017/tests/01_basic/tests.json index 60ff192..5207f96 100644 --- a/ifj2017/tests/01_basic/tests.json +++ b/ifj2017/tests/01_basic/tests.json @@ -19,32 +19,27 @@ "stdout": "? Martin Kobelka napsal tento test" }, { - "name": "13", "info": "Multi line string", "stdout": "ahoj\nsvete", "code": "scope \n print !\"ahoj\\nsvete\"; \nend scope" }, { - "name": "14", "info": "Simple integer print", "stdout": " 42", "code": "scope \n print 42; \nend scope" }, { - "name": "15", "info": "Simple double print", "stdout": " 5876.78", "code": "scope \n print 5876.78; \nend scope" }, { - "name": "16", "info": "Simple input and print", "stdin": "42", "stdout": "? 42", "code": "scope \n dim a as integer \n input a \n print a; \nend scope" }, { - "name": "17", "info": "Add two inputs", "stdin": "42\n24", "stdout": "? ? 66", diff --git a/ifj2017/tests/02_functions/tests.json b/ifj2017/tests/02_functions/tests.json index bb132a5..c0c0520 100644 --- a/ifj2017/tests/02_functions/tests.json +++ b/ifj2017/tests/02_functions/tests.json @@ -13,13 +13,11 @@ "compiler_exit_code": 4 }, { - "name": "01", "info": "Asc value", "stdout": " 104", "code": "scope \n print asc(!\"ahoj\", 2); \n end scope" }, { - "name": "02", "info": "Chr function", "stdout": "a", "code": "scope \n print chr(97); \n end scope"