From f1521c9769f9b28cf658a9255dbfc16c98870da9 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Tue, 12 Jan 2016 13:14:05 +0100 Subject: Get number of passed/total tests from Prolog test functions --- server/prolog_session.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'server') diff --git a/server/prolog_session.py b/server/prolog_session.py index 8a5b6e3..121f802 100644 --- a/server/prolog_session.py +++ b/server/prolog_session.py @@ -122,8 +122,8 @@ class PrologSession(server.LanguageSession): hints = [] try: # check if the program is already correct - passed, _ = problem_module.test(program, aux_code=aux_code) - if passed: + n_correct, n_all, _ = problem_module.test(program, aux_code=aux_code) + if n_correct == n_all: hints = [{'id': 'program_already_correct'}] if not hints and hasattr(language_module, 'hint'): @@ -133,8 +133,8 @@ class PrologSession(server.LanguageSession): if not hints and problem_id in _edits: # Testing function for monkey. def tester(code): - passed, hints = problem_module.test(code, aux_code=aux_code) - return passed + n_correct, n_all, _ = problem_module.test(code, aux_code=aux_code) + return n_correct, n_all solution, steps, fix_time, n_tested = monkey.fix( program, _edits[problem_id], tester, timeout=5, debug=True) if solution and steps: @@ -156,8 +156,8 @@ class PrologSession(server.LanguageSession): aux_code = self._aux_code(session.get_uid(), problem, program) try: - passed, hints = problem_module.test(program, aux_code=aux_code) - if passed: + n_correct, n_all, hints = problem_module.test(program, aux_code=aux_code) + if n_correct == n_all: session.update_solution(problem_id, done=True) except AttributeError as ex: hints = [{'id': 'system_error', 'args': {'message': 'test function does not exist'}}] -- cgit v1.2.1