tests/testthat/test_check_exposure.R

context("Check_exposure")

test_that("Checking check exposure",{
  
  #Check that if X has a negative (exposure) value the function throws an error
  expect_warning({
    X <- as.matrix(runif(100,-.2, 1))
    check.exposure(X)
  })
  
  expect_warning({
    X <- as.matrix(-.1)
    check.exposure(X)
  })
  
  #Check that if all values are positive returns true
  expect_true({
    X <- as.matrix(runif(100))
    check.exposure(X)
  })
  
  expect_true({
    X <- as.matrix(rlnorm(100))
    check.exposure(X)
  })
})

Try the pifpaf package in your browser

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

pifpaf documentation built on May 1, 2019, 9:11 p.m.