tests/testthat/test-is-null.R

test_that("test.is_null.na.returns_false", {
  expect_false(actual <- assertive.properties::is_null(NA))
  expect_match(
    assertive.base::cause(actual),
    "NA is not NULL; its value is NA"
  )
})

test_that("test.is_null.nan.returns_false", {
  expect_false(actual <- assertive.properties::is_null(NaN))
  expect_match(
    assertive.base::cause(actual),
    "NaN is not NULL; its value is NaN"
  )
})

test_that("test.is_null.null.returns_true", {
  expect_true(assertive.properties::is_null(NULL))
}) 

test_that("test.is_not_null.na.returns_true", {
  expect_true(assertive.properties::is_not_null(NA))
})

test_that("test.is_not_null.nan.returns_true", {
  expect_true(assertive.properties::is_not_null(NaN))
})

test_that("test.is_not_null.null.returns_false", {
  expect_false(actual <- assertive.properties::is_not_null(NULL))
  expect_match(
    assertive.base::cause(actual),
    "NULL is NULL"
  )
}) 

Try the assertive.properties package in your browser

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

assertive.properties documentation built on April 21, 2022, 5:13 p.m.