tests/testthat/test_checkScalarNA.R

context("checkScalarNA")

test_that("checkScalarNA", {
  expect_succ_all("ScalarNA", NA)
  expect_fail_all("ScalarNA", 1)
  expect_true(testScalarNA(NA_real_))
  expect_false(testScalarNA(1))
  expect_false(testScalarNA(rep(NA_character_, 2)))
  expect_expectation_successful(expect_scalar_na(NA), label = NULL)

  expect_error(assertScalarNA(integer(0)), "missing value")
})

Try the checkmate package in your browser

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

checkmate documentation built on July 4, 2019, 5:12 p.m.