tests/testthat/test-helpers.R

library(dplyr)

test_that("multiplication works", {
  expect_snapshot(
    iris |>
      arrange(Sepal.Length) |>
      mutate(
        page = make_grouped_pagenums(Species, 5)
      )
  )
})

test_that("Splits can be identified", {
  groups <- c('a', 'a', 'a', 'b', 'b', 'b', 'c', 'c')
  nonempty <- c('a', '', '', 'b', '', '', 'c', '')

  expect_equal(which(find_split_inds(groups, "change")), c(1, 4, 7))
  expect_equal(which(find_split_inds(nonempty, "nonempty")), c(1, 4, 7))
})

Try the clinify package in your browser

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

clinify documentation built on Aug. 8, 2025, 7:45 p.m.