testthat Testing Framework
Overview
Qualified supports the testthat testing framework.
testthat Quick Start
- Solution Code
say_hello <- function(name = NULL) {
if( !is.null(name) )
paste("Hello, ", name, "!", sep="")
else
"Hello there!"
}
- Test Fixture:
context("Code Challenge Sample")
test_that("should say hello", {
expect_equal(say_hello("Qualified"), "Hello, Qualified!")
})
test_that("should handle blank input", {
expect_equal(say_hello(), "Hello there!")
})