tests/testthat/test_to_decimal.R

test_that("to_decimal()", {
  expect_identical(
    to_decimal(c(1, 0)),
    2L
  )
  expect_identical(
    to_decimal(c(1, 1)),
    3L
  )

  expect_error(
    to_decimal(c(NA, 1)),
    "missing"
  )

  expect_equal(
    to_decimal(logical()),
    0L
  )

  expect_error(
    to_decimal(rep(TRUE, 31)),
    "for vectors with"
  )
})

Try the mlr3misc package in your browser

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

mlr3misc documentation built on June 25, 2024, 1:07 a.m.