tests/testthat/test-my_lm.R

# within test-my_lm.R

# load data for test
data(mtcars)

test_that("estimated coefficients correct for given input data and formula", {
  expect_equal(my_lm(mpg ~ hp + wt, data = mtcars)[, 1],
               lm(mpg ~ hp + wt, data = mtcars)$coefficients)
})
dzeng8/STAT302PACKAGE documentation built on Dec. 20, 2021, 2:19 a.m.