It runs both the solution and the student submission, and populates the state
with parse data, output, etc. After running this function, the state is
available thorugh ex
, from which you can start your SCT chains.
In a way, this function is a very light weight version of DataCamp's R Backend.
setup_state(sol_code = "", stu_code = "", sol_env = NULL, stu_env = NULL, stu_result = NULL, pec = character(), ex_type = "NormalExercise", force_diagnose = FALSE)
sol_code | Solution script as a string. If it is not specified, the student code will be used. |
---|---|
stu_code | Student submission as a string. If it is not specified, the solution code will be used. |
sol_env | Solution environment. If this is specified, the solution code is not rerun. |
stu_env | Student environment. If this is specified, the student code is not rerun. |
stu_result | Result of calling |
pec | Pre-exercise-code as a string |
ex_type | Type of exercise as a string. Defaults to NormalExercise. |
force_diagnose | whether diagnose tests have to pass even if the checks pass (FALSE by default) |
The exercise state, from which you can start chaining.
This function is only supposed to be used locally when experimenting. It should never be used in the eventual SCT script of an exercise.
if (FALSE) { setup_state( sol_code = "a <- 1", stu_code = "a <- 2" ) ex() %>% check_object('a') %>% check_equal() }