Run autograder test cases and write Gradescope-compatible JSON
Source:R/autograder.R
run_autograder.RdIterates over test_cases, calls each test function, compares the
return value to the expected value, accumulates scores, and writes the
results to a JSON file that Gradescope can parse. Also prints a summary
to the console when verbose = TRUE.
Arguments
- test_cases
A list of test-case lists. Each entry must contain:
nameHuman-readable criterion label shown to students.
funThe test function: a function object or a character string naming a function visible in the calling environment.
argsA list of arguments passed to
funviado.call.expectExpected return value; compared via
.ag_to_string().visibility"visible"(default) or"hidden".weightPoint value for this criterion.
- json_path
Output path for the JSON results file. Defaults to
"/autograder/results/results.json"inside a Gradescope container and"results.json"otherwise (detected via theASSIGNMENT_TITLEenvironment variable).- verbose
Logical. Print per-test summaries to the console. Default
TRUE.