From 3bbaa1e17778fb3790a9546d365444c38df31e1a Mon Sep 17 00:00:00 2001 From: mahesh Date: Sat, 13 May 2017 02:14:13 +0530 Subject: added pretty stdio functionality for all languages. --- yaksh/stdio_evaluator.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) (limited to 'yaksh/stdio_evaluator.py') diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py index 554d4c5..a5785ea 100644 --- a/yaksh/stdio_evaluator.py +++ b/yaksh/stdio_evaluator.py @@ -5,6 +5,7 @@ import signal # Local imports from .base_evaluator import BaseEvaluator from .grader import TimeoutException +from .compare_stdio import CompareOutputs class StdIOEvaluator(BaseEvaluator): @@ -20,18 +21,9 @@ class StdIOEvaluator(BaseEvaluator): os.killpg(os.getpgid(proc.pid), signal.SIGTERM) raise expected_output = expected_output.replace("\r", "") - if not expected_input: - error_msg = "Expected Output is\n{0} ".\ - format(str(expected_output)) - else: - error_msg = "Given Input is\n{0}\nExpected Output is\n{1}".\ - format(expected_input, str(expected_output)) - if output_err == '': - if user_output == expected_output: - success, err = True, None - else: - err = "Incorrect answer:\n" + error_msg +\ - "\nYour output is\n{0}".format(str(user_output)) - else: - err = "Error:\n{0}".format(output_err) + compare = CompareOutputs() + success, err = compare.compare_outputs(expected_output, + user_output, + expected_input + ) return success, err -- cgit From 77f05d3df90a70ff97285deb5bda2d91d99e65d5 Mon Sep 17 00:00:00 2001 From: mahesh Date: Mon, 22 May 2017 14:32:47 +0530 Subject: changes variable and dict key names along with other minor changes in answerpaper. --- yaksh/stdio_evaluator.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'yaksh/stdio_evaluator.py') diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py index a5785ea..932ae7e 100644 --- a/yaksh/stdio_evaluator.py +++ b/yaksh/stdio_evaluator.py @@ -5,7 +5,7 @@ import signal # Local imports from .base_evaluator import BaseEvaluator from .grader import TimeoutException -from .compare_stdio import CompareOutputs +from .compare_stdio import compare_outputs class StdIOEvaluator(BaseEvaluator): @@ -21,9 +21,8 @@ class StdIOEvaluator(BaseEvaluator): os.killpg(os.getpgid(proc.pid), signal.SIGTERM) raise expected_output = expected_output.replace("\r", "") - compare = CompareOutputs() - success, err = compare.compare_outputs(expected_output, - user_output, - expected_input - ) + success, err = compare_outputs(expected_output, + user_output, + expected_input + ) return success, err -- cgit