tests/testthat/test-adl.R

test_that("adl_fun has expected output when ADL_01 is out of range",{
  expect_equal(adl_fun(-1, 1, 1, 1, 1), "NA(b)")
})

test_that("adl_fun has expected output when ADL_02 is out of range",{
  expect_equal(adl_fun(1, -1, 1, 1, 1), "NA(b)")
})

test_that("adl_fun has expected output when ADL_03 is out of range",{
  expect_equal(adl_fun(1, 1, -1, 1, 1), "NA(b)")
})

test_that("adl_fun has expected output when ADL_04 is out of range",{
  expect_equal(adl_fun(1, 1, 1, -1, 1), "NA(b)")
})

test_that("adl_fun has expected output when ADL_05 is out of range",{
  expect_equal(adl_fun(1, 1, 1, 1, -1), "NA(b)")
})

test_that("adl_fun has expected output when all values are in range",{
  expect_equal(adl_fun(1, 1, 1, 1, 1), 1)
})

test_that("adl_score_5_fun has expected output when ADL_01 is out of range",{
  expect_equal(adl_score_5_fun("NA(b)", 1, 1, 1, 1), "NA(b)")
})

test_that("adl_score_5_fun has expected output when ADL_02 is out of range",{
  expect_equal(adl_score_5_fun(1, "NA(b)", 1, 1, 1), "NA(b)")
})

test_that("adl_score_5_fun has expected output when ADL_03 is out of range",{
  expect_equal(adl_score_5_fun(1, 1, "NA(b)", 1, 1), "NA(b)")
})

test_that("adl_score_5_fun has expected output when ADL_04 is out of range",{
  expect_equal(adl_score_5_fun(1, 1, 1, "NA(b)", 1), "NA(b)")
})

test_that("adl_score_5_fun has expected output when ADL_05 is out of range",{
  expect_equal(adl_score_5_fun(1, 1, 1, 1, "NA(b)"), "NA(b)")
})

test_that("adl_score_5_fun has expected output when all values are in range",{
  expect_equal(adl_score_5_fun(1, 1, 1, 1, 1), 0)
})

Try the cchsflow package in your browser

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

cchsflow documentation built on May 28, 2022, 1:09 a.m.