tests/testthat/test_findC.R

context("")
test_that("The optimal C is/are", {
  expect_equal(round(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120))[1], 2), 1065.97)
  expect_equal(round(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120), max.lag = 2)[1], 2), 1065.97)
  expect_equal(round(findC(timepoints = c(0, 5, 10, 15, 20, 25, 30, 35), max.lag = 2)[4], 2), 132.97)
  expect_equal(round(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120), max.lag = 2)[5], 2), 2212.09)
  expect_equal(round(findC(timepoints = c(0, 0.5, 3, 6, 12), max.lag = 1)[1], 0), 19)
  expect_error(findC(timepoints = c(0, 5, 10, 15, 20, 25, 30, 35), max.lag = 3))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120), max.lag = 2, pi = 0.2))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120), max.lag = 1, pi = 1.12))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90, 120), max.lag = 1, pi = 0.9, iter = 1))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90), max.lag = 1, pi = 0.9, iter = 1))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90), max.lag = 1, pi = 0.9, iter = 0.4))
  expect_error(findC(timepoints = c(0, 5, 15, 30, 60, 75, 90), max.lag = 1.2, pi = 0.9, iter = 1))
})
gitter-lab/LPWC documentation built on May 7, 2020, 2:02 p.m.