tests/testthat/test_compose.R

test_that("compose", {
  f = compose(function(x) x + 1, function(x) x / 2)
  expect_equal(f(10), 6)

  f = compose(sqrt)
  expect_equal(f(4), 2)
  expect_error(compose(), "length")
})
mlr-org/mlr3misc documentation built on Aug. 21, 2024, 4:06 a.m.