tests/testthat/test-cv.R

# Run all tests in this script:
## testthat::test_file(file.path("tests", "testthat", "test-cv.R"))

# Simple error testing
test_that("Only accepts correct inputs", {
  expect_error(cv(x = c("x", "y", "z"), na_rm = TRUE))
})

# Warning testing
test_that("Warnings are returned",{
  expect_warning(cv(x = c(1:10), na_rm = "false"))
})

# Output testing
test_that("Outputs are correct", {
  expect_equal(cv(x = c(1:10), na_rm = TRUE), 0.55048188)
})

Try the ltertools package in your browser

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

ltertools documentation built on April 11, 2025, 6:14 p.m.