diff options
Diffstat (limited to 'testapp/exam/cpp_code_evaluator.py')
-rw-r--r-- | testapp/exam/cpp_code_evaluator.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/testapp/exam/cpp_code_evaluator.py b/testapp/exam/cpp_code_evaluator.py index 04efba8..15e2b13 100644 --- a/testapp/exam/cpp_code_evaluator.py +++ b/testapp/exam/cpp_code_evaluator.py @@ -12,19 +12,20 @@ from code_evaluator import CodeEvaluator class CppCodeEvaluator(CodeEvaluator): """Tests the C code obtained from Code Server""" - def __init__(self, test_case_data, test, language, user_answer, - ref_code_path=None, in_dir=None): - super(CppCodeEvaluator, self).__init__(test_case_data, test, language, user_answer, - ref_code_path, in_dir) + def __init__(self, test_case_data, test, language, user_answer, + ref_code_path=None, in_dir=None): + super(CppCodeEvaluator, self).__init__(test_case_data, test, language, + user_answer, ref_code_path, + in_dir) self.submit_path = self.create_submit_code_file('submit.c') - self.test_case_args = self._setup() + self.test_case_args = self._setup() # Private Protocol ########## def _setup(self): super(CppCodeEvaluator, self)._setup() get_ref_path = self.ref_code_path - ref_path, test_case_path = self.set_test_code_file_path(get_ref_path) + ref_path, test_case_path = self._set_test_code_file_path(get_ref_path) # Set file paths c_user_output_path = os.getcwd() + '/output' @@ -40,7 +41,8 @@ class CppCodeEvaluator(CodeEvaluator): remove_user_output = c_user_output_path remove_ref_output = c_ref_output_path - return ref_path, self.submit_path, compile_command, compile_main, run_command_args, remove_user_output, remove_ref_output + return (ref_path, self.submit_path, compile_command, compile_main, + run_command_args, remove_user_output, remove_ref_output) def _teardown(self): # Delete the created file. @@ -75,10 +77,8 @@ class CppCodeEvaluator(CodeEvaluator): return False, 'No file at %s or Incorrect path' % submit_code_path success = False - # output_path = os.getcwd() + '/output' ret = self._compile_command(compile_command) proc, stdnt_stderr = ret - # if self.language == "java": stdnt_stderr = self._remove_null_substitute_char(stdnt_stderr) # Only if compilation is successful, the program is executed @@ -86,7 +86,6 @@ class CppCodeEvaluator(CodeEvaluator): if stdnt_stderr == '': ret = self._compile_command(compile_main) proc, main_err = ret - # if self.language == "java": main_err = self._remove_null_substitute_char(main_err) if main_err == '': |