inst/tinytest/test-which_true_onwards.R

#context "test-which_true_onwards")

# test_that("Error handling", {
  expect_error(which_true_onwards(1), "logical")
  expect_error(which_true_onwards(NA), "missing")


# test_that("which_true_onwards works", {
  expect_identical(which_true_onwards(c(TRUE, TRUE, FALSE, TRUE, TRUE)),
                   4L)
  expect_identical(which_true_onwards(c(TRUE, FALSE)),
                   0L)
  expect_identical(which_true_onwards(c(TRUE, TRUE)),
                   1L)
  expect_identical(which_true_onwards(c(FALSE)),
                   0L)

Try the hutilscpp package in your browser

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

hutilscpp documentation built on Oct. 11, 2023, 9:06 a.m.