summaryrefslogtreecommitdiff
path: root/yaksh/cpp_code_evaluator.py
diff options
context:
space:
mode:
authormaheshgudi2018-07-04 16:34:56 +0530
committermaheshgudi2018-07-12 18:27:27 +0530
commit99f0c944fafec51b9327fe5dea01096842788e03 (patch)
treeec3586b1fca3f48c97bb24b131451677bea7a856 /yaksh/cpp_code_evaluator.py
parenta850749942d163f9aedb19a1d19c4b8d7016745d (diff)
downloadonline_test-99f0c944fafec51b9327fe5dea01096842788e03.tar.gz
online_test-99f0c944fafec51b9327fe5dea01096842788e03.tar.bz2
online_test-99f0c944fafec51b9327fe5dea01096842788e03.zip
Raise appropriate exceptions for C and Java language to the Grader
- Raise AssertionError,CompilationError and TestCaseError for assertion, user answer compilation and testcase compilation errors respectively. - Add test case for C/C++ and Java
Diffstat (limited to 'yaksh/cpp_code_evaluator.py')
-rw-r--r--yaksh/cpp_code_evaluator.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/yaksh/cpp_code_evaluator.py b/yaksh/cpp_code_evaluator.py
index 8bd3beb..d249c66 100644
--- a/yaksh/cpp_code_evaluator.py
+++ b/yaksh/cpp_code_evaluator.py
@@ -7,6 +7,7 @@ import subprocess
# Local imports
from .file_utils import copy_files, delete_files
from .base_evaluator import BaseEvaluator
+from .grader import CompilationError, TestCaseError
class CppCodeEvaluator(BaseEvaluator):
@@ -141,6 +142,7 @@ class CppCodeEvaluator(BaseEvaluator):
mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = "{0} \n {1}".format(stdout, stderr)
+ raise AssertionError(err)
else:
err = "Test case Error:"
try:
@@ -152,6 +154,7 @@ class CppCodeEvaluator(BaseEvaluator):
err = "{0} \n {1}".format(err, e)
except Exception:
err = "{0} \n {1}".format(err, main_err)
+ raise TestCaseError(err)
else:
err = "Compilation Error:"
try:
@@ -163,5 +166,6 @@ class CppCodeEvaluator(BaseEvaluator):
err = "{0} \n {1}".format(err, e)
except Exception:
err = "{0} \n {1}".format(err, stdnt_stderr)
+ raise CompilationError(err)
return success, err, mark_fraction