test<- {hySpc.testthat}R Documentation

Attach unit tests to objects

Description

This function attaches unit tests in value to an object (typically a function) as an attribute "test".

Usage

test(f) <- value

Arguments

f

the function (object) to which the tests are to be attached

value

the test code, a function with no parameters

Value

f with the test attached as attribute "test"

Examples

f <- function(x) x^2

test(f) <- function() {
   context("f")

   test_that("correct result for complex number", {
     expect_equal(f(1i), -1 + 0i)
   })
}

[Package hySpc.testthat version 0.2.1 Index]