tests/testthat/test-checkmate.R

# check_proportion ----

test_that("check_proportion works as expected", {
  expect_identical(
    check_proportion(2),
    "Must be a 'proportion': number between 0 and 1"
  )
  expect_identical(
    check_proportion(NULL),
    "Must be a 'proportion': number between 0 and 1"
  )
  expect_identical(
    check_proportion(c(0.5, 0.9)),
    "Must be a 'proportion': number between 0 and 1"
  )
  expect_true(
    check_proportion(0.5)
  )
})
insightsengineering/hermes documentation built on Jan. 25, 2025, 6:21 a.m.