tests/testthat/test_odd_even.R

context("test odd_even")

test_that("odd works fine", {
 #no tableHTML
 expect_error(odd(1:10), NA)

})

test_that("odd outputs correct", {
 #no tableHTML
 expect_equal(odd(1:10), c(1, 3, 5, 7, 9))

})

test_that("even works fine", {
 #no tableHTML
 expect_error(even(1:10), NA)

})

test_that("even outputs correct", {
 #no tableHTML
 expect_equal(even(1:10), c(2, 4, 6, 8, 10))

})

test_that("checks work", {

 expect_error(even(TRUE),
              "vec needs to be numeric")

 expect_error(odd("a"),
              "vec needs to be numeric")

})

Try the tableHTML package in your browser

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

tableHTML documentation built on April 18, 2023, 1:11 a.m.