summaryrefslogtreecommitdiff
path: root/yaksh/stdio_evaluator.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-05-25 18:58:31 +0530
committerGitHub2017-05-25 18:58:31 +0530
commiteae6ee7ceb25f78b216a5e2c9d6165513272e4cb (patch)
tree2758e1ec86c533b58d0fa3e7f4f5304bcd2431ec /yaksh/stdio_evaluator.py
parent80b67d07ceaf4c73705a27ee0bfc905e30b19ac4 (diff)
parent77f05d3df90a70ff97285deb5bda2d91d99e65d5 (diff)
downloadonline_test-eae6ee7ceb25f78b216a5e2c9d6165513272e4cb.tar.gz
online_test-eae6ee7ceb25f78b216a5e2c9d6165513272e4cb.tar.bz2
online_test-eae6ee7ceb25f78b216a5e2c9d6165513272e4cb.zip
Merge pull request #297 from maheshgudi/difflib
StdIO error output simplification
Diffstat (limited to 'yaksh/stdio_evaluator.py')
-rw-r--r--yaksh/stdio_evaluator.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/yaksh/stdio_evaluator.py b/yaksh/stdio_evaluator.py
index 554d4c5..932ae7e 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 compare_outputs
class StdIOEvaluator(BaseEvaluator):
@@ -20,18 +21,8 @@ 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)
+ success, err = compare_outputs(expected_output,
+ user_output,
+ expected_input
+ )
return success, err