diff options
author | ankitjavalkar | 2016-11-16 17:42:47 +0530 |
---|---|---|
committer | ankitjavalkar | 2016-11-16 18:12:48 +0530 |
commit | 0b151541d9414572965b597815f98c4b057430e1 (patch) | |
tree | f77c092f65b4b8ba367604596f0f5b40ca2e3794 | |
parent | 31a15a666e69d96b5062596c79641645a64fcdb2 (diff) | |
download | online_test-0b151541d9414572965b597815f98c4b057430e1.tar.gz online_test-0b151541d9414572965b597815f98c4b057430e1.tar.bz2 online_test-0b151541d9414572965b597815f98c4b057430e1.zip |
Fix error where answer is correct if last test case is correct
-rw-r--r-- | yaksh/code_evaluator.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/yaksh/code_evaluator.py b/yaksh/code_evaluator.py index 50fc546..8cea94e 100644 --- a/yaksh/code_evaluator.py +++ b/yaksh/code_evaluator.py @@ -108,25 +108,30 @@ class CodeEvaluator(object): # Add a new signal handler for the execution of this code. prev_handler = create_signal_handler() success = False + test_case_success_status = [False] * len(test_case_data) error = "" - weight = 0 + weight = 0.0 # Do whatever testing needed. try: - for test_case in test_case_data: - success = False + for idx, test_case in enumerate(test_case_data): + test_case_success = False self.compile_code(user_answer, file_paths, **test_case) - success, err, test_case_weight = self.check_code(user_answer, + test_case_success, err, test_case_weight = self.check_code(user_answer, file_paths, partial_grading, **test_case ) - if success: + if test_case_success: weight += test_case_weight error = err else: error += err + "\n" + test_case_success_status[idx] = test_case_success + + success = all(test_case_success_status) + except TimeoutException: error = self.timeout_msg except OSError: |