tests/testthat/test-limit.R

test_that("limit() works", {
  expect_equal(limit(1:6, 2, 4), c(2, 2, 3, 4, 4, 4))
  expect_equal(limit(1:6, 2L, 4L), c(2L, 2L, 3L, 4L, 4L, 4L))
})

test_that("limit() errors", {
  expect_error(limit(1, "a", 1), class = "simpleError")
  expect_error(limit(1, 1:2, 1), class = "simpleError")
  expect_error(limit(1, 1, "a"), class = "simpleError")
  expect_error(limit(1, 1, 1:2), class = "simpleError")
  expect_error(limit(1, 2, 1),   class = "simpleError")
})
jmbarbone/jordan documentation built on April 1, 2024, 7:46 p.m.