tests/testthat/test-ilength.R

test_that("ilength functions properly with a vector", {
  expect_equal(count(1:5), 5)
})

test_that("ilength functions properly with an iteror", {
  it <- iteror(1:5)
  expect_equal(count(it), 5)
})

test_that("ilength functions properly with a chained iteror", {
  it <- i_chain(1:3, 4:5, 6)
  expect_equal(count(it), 6)
})

test_that("ilength functions properly with a chained iteror of mixed types", {
  it <- i_chain(1:3, levels(iris$Species))
  expect_equal(count(it), 6)
})

Try the iterors package in your browser

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

iterors documentation built on May 31, 2023, 5:36 p.m.