tests/testthat/test-quantify.r

context("quantify an iterator of logical values")

test_that("quantify functions properly with a logical vector", {
  set.seed(42)
  x <- sample(c(TRUE, FALSE), size=10, replace=TRUE)
  expect_equal(quantify(x), sum(x))
})

test_that("quantify functions properly with an iterator from a logical vector", {
  set.seed(42)
  x <- sample(c(TRUE, FALSE), size=10, replace=TRUE)
  it <- iterators::iter(x)
  expect_equal(quantify(it), sum(x))
})

Try the itertools2 package in your browser

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

itertools2 documentation built on May 2, 2019, 3:37 p.m.