From 99f0c944fafec51b9327fe5dea01096842788e03 Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Wed, 4 Jul 2018 16:34:56 +0530 Subject: 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 --- yaksh/java_code_evaluator.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'yaksh/java_code_evaluator.py') diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py index 5f2288d..35573c0 100644 --- a/yaksh/java_code_evaluator.py +++ b/yaksh/java_code_evaluator.py @@ -7,6 +7,7 @@ import subprocess # Local imports from .base_evaluator import BaseEvaluator from .file_utils import copy_files, delete_files +from .grader import CompilationError, TestCaseError class JavaCodeEvaluator(BaseEvaluator): @@ -149,6 +150,7 @@ class JavaCodeEvaluator(BaseEvaluator): mark_fraction = 1.0 if self.partial_grading else 0.0 else: err = stdout + "\n" + stderr + raise AssertionError(err) else: err = "Test case Error:" try: @@ -160,6 +162,7 @@ class JavaCodeEvaluator(BaseEvaluator): err = err + "\n" + e except Exception: err = err + "\n" + main_err + raise TestCaseError(err) else: err = "Compilation Error:" try: @@ -171,5 +174,6 @@ class JavaCodeEvaluator(BaseEvaluator): err = err + "\n" + e except Exception: err = err + "\n" + stdnt_stderr + raise CompilationError(err) return success, err, mark_fraction -- cgit