tests/testthat/test-checkFuns.R

context("Input components")
fitFunTest = function(y, x){lm.fit(y = y, x = cbind(1, x))}
predFunTest = function(mod, x) {cbind(1,x) %*% mod$coef}
test_that("check functions return functions for good input functions", {
    expect_is(checkFitFun(fitFunTest), "function")
    expect_is(checkPredFun(predFunTest), "function")
})
test_that("check functions throw error when input is wrong", {
    expect_error(checkFitFun(predFunTest))
    expect_error(checkPredFun(fitFunTest))
})

Try the oosse package in your browser

Any scripts or data that you put into this service are public.

oosse documentation built on May 29, 2024, 10:35 a.m.