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 June 12, 2025, 9:54 p.m.