tests/testthat/test-my_pow.R

# within test-my_pow.R
test_that("my_pow works mathematically", {
  expect_equal(my_pow(2), 4)
  expect_equal(my_pow(2, power = 3), 8)
})
test_that("non-numeric input throws error", {
  expect_error(my_pow("a string"))
  expect_error(my_pow(2, power = "a string"))
})
dzeng8/STAT302PACKAGE documentation built on Dec. 20, 2021, 2:19 a.m.