#' This function is for students.
#' This function tests functions in the current environment.
test_env_functions <- function(elapsedSeconds = 10) {
table <- list()
all_function_names <- as.vector(lsf.str(.GlobalEnv))
for (function_name in all_function_names) {
if (function_name %in% names(test_cases)) {
result_list <- c()
for (test_case in test_cases[[function_name]]) {
tryCatch({
result <- with_timeout(eval(parse(text = test_case)), Inf, elapsedSeconds)
}, error = function(e) {
result <- FALSE
}, finally = {
result_list <- c(result_list, result)
})
}
table[[function_name]] <- result_list
}
}
return(table)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.