test_students: FUNCTION_TITLE

Description Usage Arguments Details Value Examples

View source: R/test_students.R

Description

FUNCTION_DESCRIPTION

Usage

1
2
3
4
5
test_students(hw_submitters, sol_file, tests_to_run, timeout = 0.5,
  use_do.call, check_sol_fun = function(student_sol, teacher_sol) {    
  isTRUE(all.equal(student_sol, teacher_sol, tolerance = 1e-04, check.attributes
  = FALSE)) }, update_student_fun = NULL, max_grade = 100,
  mistakes_folder = "mistakes")

Arguments

hw_submitters

a vector of .R files to check

sol_file

the location of the .R file with the correct solution. This file should have the functions that solves the homework's questions.

tests_to_run

a list with elements as the number of questions in the homework assignment. Each element in the list is named by the name of the function. So if the homework said to create a function called fo then the list will contain an element named "fo". The "fo" element will itself be a list with the inputs to check on the functions. If the input is NA then the function will be run as 'fo()'.' If the function fo includes several parameters (say fo(a = "something", b = "another smthng")) then each element inside "fo" will be a list of the form list("input", "b input"). (you can also use list(a = "input", b = "b input") but then if the student wrote the function as function(A="not a", B = "not b") then his function would fail. Indicating the input just by the order makes it simpler). The function do.call will be used to run this input in fo.

timeout

The number of seconds to wait for the function to end before deciding the student got into an infinite loop and to exist the function and declare the student failed to answer the question. Default: 0.5

use_do.call

if to force the use of do.call on the list_of_inputs. By default is not set, in which case the function will try to guess if to use it or not (based on the solution by the teacher and the arguments in the list_of_inputs)

check_sol_fun

the function to use to compare the solutions. if you wish to set a specific function for a test, the "check_sol_fun" attribute should be added to that test in the list. attr(current_test, "check_sol_fun") PARAM_DESCRIPTION, Default: function(student_sol, teacher_sol) isTRUE(all.equal( student_sol, teacher_sol, tolerance = 0.01, check.attributes = FALSE ))

update_student_fun

the function to use on the student's function to fix a problem. "update_student_fun" attribute can be added to that test in the list. default is NULL. this is when the teachers write fo <- function(x) ... And the student writes fo <- function(y) ... we can make sure to fix the student's mistake using: function(f) fix_first_arg_in_fun(f, "x")

student_id_fun

a character string indicating the name of the function a student was instructed to create that returns is id (for example my_id() "id number") If NULL, then the file name is used.

Details

DETAILS

Value

OUTPUT_DESCRIPTION

Examples

1
2
3
4
5
6
## Not run: 
if(interactive()){
 #EXAMPLE1
 }

## End(Not run)

talgalili/homework documentation built on July 10, 2019, 1:41 p.m.