tests/testthat/test_exceeds_tumbling_sum.R

test_that("cumsum_threshold works as expected", {

  x <- c(1, 5, 5, 3)
  expect_identical(
    exceeds_tumbling_sum(x, 6),
    c(FALSE, TRUE, FALSE, TRUE)
  )

  expect_identical(
    exceeds_tumbling_sum(x, 6),
    exceeds_tumbling_sum(as.integer(x), 6L)
  )


})

Try the lest package in your browser

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

lest documentation built on Jan. 11, 2020, 9:37 a.m.