summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorankitjavalkar2016-12-27 15:52:07 +0530
committerankitjavalkar2016-12-27 15:52:07 +0530
commitb617a0279a486ca4d98a2ca55d2f4d0fcf56e5e2 (patch)
tree7b10d5342eb289d4d9c24e17b5a1471b8dea14c2
parent48366e84b98157ac32b22b2aa19b1c1cde68afd4 (diff)
downloadonline_test-b617a0279a486ca4d98a2ca55d2f4d0fcf56e5e2.tar.gz
online_test-b617a0279a486ca4d98a2ca55d2f4d0fcf56e5e2.tar.bz2
online_test-b617a0279a486ca4d98a2ca55d2f4d0fcf56e5e2.zip
Add floating point mark_weight to control test case weightage
-rw-r--r--yaksh/bash_code_evaluator.py4
-rw-r--r--yaksh/bash_stdio_evaluator.py2
-rw-r--r--yaksh/cpp_code_evaluator.py2
-rw-r--r--yaksh/cpp_stdio_evaluator.py2
-rw-r--r--yaksh/grader.py6
-rw-r--r--yaksh/java_code_evaluator.py2
-rw-r--r--yaksh/java_stdio_evaluator.py2
-rw-r--r--yaksh/python_assertion_evaluator.py2
-rw-r--r--yaksh/scilab_code_evaluator.py6
9 files changed, 14 insertions, 14 deletions
diff --git a/yaksh/bash_code_evaluator.py b/yaksh/bash_code_evaluator.py
index 975af82..1f02fdb 100644
--- a/yaksh/bash_code_evaluator.py
+++ b/yaksh/bash_code_evaluator.py
@@ -103,7 +103,7 @@ class BashCodeEvaluator(BaseEvaluator):
)
proc, stdnt_stdout, stdnt_stderr = ret
if inst_stdout == stdnt_stdout:
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
return True, None, mark_fraction
else:
err = "Error: expected %s, got %s" % (inst_stderr,
@@ -146,7 +146,7 @@ class BashCodeEvaluator(BaseEvaluator):
proc, stdnt_stdout, stdnt_stderr = ret
valid_answer = inst_stdout == stdnt_stdout
if valid_answer and (num_lines == loop_count):
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
return True, None, mark_fraction
else:
err = ("Error:expected"
diff --git a/yaksh/bash_stdio_evaluator.py b/yaksh/bash_stdio_evaluator.py
index 50ee0d6..334620d 100644
--- a/yaksh/bash_stdio_evaluator.py
+++ b/yaksh/bash_stdio_evaluator.py
@@ -55,5 +55,5 @@ class BashStdIOEvaluator(StdIOEvaluator):
self.expected_input,
self.expected_output
)
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/cpp_code_evaluator.py b/yaksh/cpp_code_evaluator.py
index 91ba703..4811b89 100644
--- a/yaksh/cpp_code_evaluator.py
+++ b/yaksh/cpp_code_evaluator.py
@@ -135,7 +135,7 @@ class CppCodeEvaluator(BaseEvaluator):
proc, stdout, stderr = ret
if proc.returncode == 0:
success, err = True, None
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = "{0} \n {1}".format(stdout, stderr)
else:
diff --git a/yaksh/cpp_stdio_evaluator.py b/yaksh/cpp_stdio_evaluator.py
index c318a82..978f1b1 100644
--- a/yaksh/cpp_stdio_evaluator.py
+++ b/yaksh/cpp_stdio_evaluator.py
@@ -112,5 +112,5 @@ class CppStdIOEvaluator(StdIOEvaluator):
err = err + "\n" + e
except:
err = err + "\n" + stdnt_stderr
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/grader.py b/yaksh/grader.py
index 0c057c2..086abb7 100644
--- a/yaksh/grader.py
+++ b/yaksh/grader.py
@@ -100,10 +100,10 @@ class Grader(object):
self.setup()
test_case_instances = self.get_evaluator_objects(kwargs)
with change_dir(self.in_dir):
- success, error, mark = self.safe_evaluate(test_case_instances)
+ success, error, weight = self.safe_evaluate(test_case_instances)
self.teardown()
- result = {'success': success, 'error': error, 'weight': mark}
+ result = {'success': success, 'error': error, 'weight': weight}
return result
# Private Protocol ##########
@@ -144,7 +144,7 @@ class Grader(object):
test_case_instance.compile_code()
test_case_success, err, mark_fraction = test_case_instance.check_code()
if test_case_success:
- weight += mark_fraction
+ weight += mark_fraction * test_case_instance.weight
else:
error.append(err)
test_case_success_status[idx] = test_case_success
diff --git a/yaksh/java_code_evaluator.py b/yaksh/java_code_evaluator.py
index 91e5840..a1bb39e 100644
--- a/yaksh/java_code_evaluator.py
+++ b/yaksh/java_code_evaluator.py
@@ -144,7 +144,7 @@ class JavaCodeEvaluator(BaseEvaluator):
proc, stdout, stderr = ret
if proc.returncode == 0:
success, err = True, None
- mark_fraction = float(seelf.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = stdout + "\n" + stderr
else:
diff --git a/yaksh/java_stdio_evaluator.py b/yaksh/java_stdio_evaluator.py
index a854847..48f265d 100644
--- a/yaksh/java_stdio_evaluator.py
+++ b/yaksh/java_stdio_evaluator.py
@@ -85,5 +85,5 @@ class JavaStdIOEvaluator(StdIOEvaluator):
err = err + "\n" + e
except:
err = err + "\n" + stdnt_stderr
- mark_fraction = float(self.weight) if self.partial_grading and success else 0.0
+ mark_fraction = 1.0 if self.partial_grading and success else 0.0
return success, err, mark_fraction
diff --git a/yaksh/python_assertion_evaluator.py b/yaksh/python_assertion_evaluator.py
index 749a6ec..ae86c46 100644
--- a/yaksh/python_assertion_evaluator.py
+++ b/yaksh/python_assertion_evaluator.py
@@ -91,6 +91,6 @@ class PythonAssertionEvaluator(BaseEvaluator):
else:
success = True
err = None
- mark_fraction = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
del tb
return success, err, mark_fraction
diff --git a/yaksh/scilab_code_evaluator.py b/yaksh/scilab_code_evaluator.py
index bf16c84..7d54e8b 100644
--- a/yaksh/scilab_code_evaluator.py
+++ b/yaksh/scilab_code_evaluator.py
@@ -43,7 +43,7 @@ class ScilabCodeEvaluator(BaseEvaluator):
self._remove_scilab_exit(self.user_answer.lstrip())
success = False
- test_case_weight = 0.0
+ mark_fraction = 0.0
self.write_to_submit_code_file(self.submit_code_path, self.user_answer)
# Throw message if there are commmands that terminates scilab
add_err = ""
@@ -70,13 +70,13 @@ class ScilabCodeEvaluator(BaseEvaluator):
stdout = self._strip_output(stdout)
if proc.returncode == 5:
success, err = True, None
- test_case_weight = float(self.weight) if self.partial_grading else 0.0
+ mark_fraction = 1.0 if self.partial_grading else 0.0
else:
err = add_err + stdout
else:
err = add_err + stderr
- return success, err, test_case_weight
+ return success, err, mark_fraction
def _remove_scilab_exit(self, string):
"""