R/test_functions.R

Defines functions test_functions

Documented in test_functions

#' This function is for students.
#' It shows the testing results a more understandable way.
#' @export
test_functions <- function() {
  table <- test_env_functions()
  for(function_name in names(table)){
    cases <- table[[function_name]]
    if (all(cases == TRUE)) {
      cat("Testing: ", function_name, "...passed!", sep = "")
    } else {
      failing_id <- which(cases == FALSE)[1]
      failing_case <- test_cases[[function_name]][failing_id]
      cat(
        "Testing: ", function_name, "...uh oh,\n\t",
        function_name, " failed on the following test case:\n\t",
        unlist(failing_case), sep = "")
    }
    cat("\n\n")
  }
}
emse-p4a-gwu/p4aGrader documentation built on May 16, 2020, 1:43 a.m.