tests/testthat/test-Vapply.R

library(functools)
context("Vapply()")

x <- runif(10000)
test_that("Produces the correct output.", {
  expect_equal(Vapply(x, function(x) x * x, numeric(1)),
               vapply(x, function(x) x * x, numeric(1)))
})

test_that("Produces the correct output type.", {
  expect_is(Vapply(x, Identity, numeric(1)), "numeric")
})

test_that("Produces the correct errors.", {
  expect_error(Vapply(Identity, x))
})

Try the functools package in your browser

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

functools documentation built on May 2, 2019, 5:39 a.m.