Commit fe6e3adb authored by Matthew P. Russell's avatar Matthew P. Russell
Browse files

changed scoring paradigm to be tests passed / total tests

parent c2e4935e
...@@ -118,33 +118,11 @@ inform("tests were set up successfully", color=SUCCESS) ...@@ -118,33 +118,11 @@ inform("tests were set up successfully", color=SUCCESS)
# initialize variables for keeping track of the grade # # initialize variables for keeping track of the grade #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# total points
overall_score = 100.0
# total points valgrind tests are worth
valgrind_score = 15.0
# number of points the standard tests are worth
standard_score = overall_score - valgrind_score
# score keeps track of the student's overall score
score = 0.0
# test_results stores the results of the regular tests
standard_test_results = []
# valgrind_test_results stores the results of the valgrind tests
valgrind_test_results = []
# how many tests there are
num_tests = len(test_names) num_tests = len(test_names)
# points per standard test num_tests_passed = 0
standard_test_max = round(standard_score / num_tests, 3)
# points per valgrind test
valgrind_test_max = round(valgrind_score / num_tests, 3)
num_valgrind_passed = 0
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# compile the tests # # compile the tests #
...@@ -164,7 +142,6 @@ else: ...@@ -164,7 +142,6 @@ else:
cleanup() cleanup()
sys.exit(1) sys.exit(1)
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
# run the tests # # run the tests #
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
...@@ -179,7 +156,7 @@ for test in test_names: ...@@ -179,7 +156,7 @@ for test in test_names:
universal_newlines = True) universal_newlines = True)
#test was successful #test was successful
if test_result.returncode == 0: if test_result.returncode == 0:
score += standard_test_max num_tests_passed += 1
inform("test passed", color=SUCCESS) inform("test passed", color=SUCCESS)
...@@ -214,7 +191,7 @@ for test in test_names: ...@@ -214,7 +191,7 @@ for test in test_names:
if valgrind_passed: if valgrind_passed:
inform("valgrind passed", color=SUCCESS) inform("valgrind passed", color=SUCCESS)
score += valgrind_test_max num_valgrind_passed += 1
else: else:
inform("valgrind failed", color=FAILURE) inform("valgrind failed", color=FAILURE)
inform(VALGRIND_RESULT.stderr, color=FAILURE) inform(VALGRIND_RESULT.stderr, color=FAILURE)
...@@ -234,17 +211,12 @@ for test in test_names: ...@@ -234,17 +211,12 @@ for test in test_names:
std_out("stderr", linebreak=True) std_out("stderr", linebreak=True)
inform(test_result.stderr, color=OUTPUT) inform(test_result.stderr, color=OUTPUT)
inform(str(num_tests_passsed) + " / " + str(num_tests) +
" tests passed", color=INFO)
# make sure final score is <= max (might happen b/c we're rounding) inform(str(num_valgrind_passsed) + " / " + str(num_tests) +
final_score = min([overall_score, round(score, 2)]) " valgrind tests passed", color=INFO)
# don't sandbag anyone b/c rounding
if final_score > 99: final_score = 100
inform("final score: " + str(final_score) + " / " + str(overall_score),
color=INFO)
# clean up # clean up
subprocess.run(['make','clean']) subprocess.run(['make','clean'])
cleanup() cleanup()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment