tests/testthat/test-max_gap_streak.R

test_that("typical usage of `max_gap_streak()`", {
  expect_equal(max_gap_streak('Val'), 0L)
  expect_equal(max_gap_streak(c('Val', '-')), 1L)
  expect_equal(max_gap_streak(c('Val', '-', '-')), 2L)

})

test_that("picking the longest streak of gaps`", {
  expect_equal(max_gap_streak(c('-', 'Val', '-', '-')), 2L)
  expect_equal(max_gap_streak(c('-', 'Val', '-', '-', 'Pro', '-', '-', '-')), 3L)

})

test_that("empty inputs", {
  expect_equal(max_gap_streak(character()), 0L)
  expect_equal(max_gap_streak(NA_character_), 0L)
  expect_equal(max_gap_streak(c(NA_character_, NA_character_)), 0L)

})

Try the agvgd package in your browser

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

agvgd documentation built on Sept. 11, 2022, 1:07 a.m.