## Not run:
# # Example:
# my_fun <- function(a, b) {
# stopifnot(is.numeric(a), is.numeric(b))
# a + b
# }
#
# # SCT option 1
# test_function_definition("my_fun",
# function_test = {
# test_expression_result("my_fun(1,2)")
# test_expression_error("my_fun('c',3)")
# }, {
# test_student_typed("+")
# })
#
# # SCT option 2
# fundef %>% check_fun_def("my_fun")
# fundef %>% check_arguments()
# fundef %>% check_call(a = 1, b = 2) %>% check_result() %>% check_equal()
# fundef %>% check_call(a = 'c', b = 3) %>% check_error() %>% check_equal()
# fundef %>% check_body() %>% check_code("+")
# ## End(Not run)
Run the code above in your browser using DataLab