tests/testthat/test-not_infinite.R

test_that("not_infinite returns FALSE if value is infinite", {
  not_infinite(Inf) %>% expect_false()
  not_infinite(-Inf) %>% expect_false()
})

test_that("not_infinite returns TRUE if value is not infinite", {
  for_all(
    a = anything(),
    property = function(a)
      (identical(a, Inf) || identical(a, -Inf) || not_infinite(a)) %>%
        expect_true()
  )
})

Try the maybe package in your browser

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

maybe documentation built on Aug. 7, 2023, 5:11 p.m.