diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testthat/test_max_twa.R | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testthat/test_max_twa.R b/tests/testthat/test_max_twa.R new file mode 100644 index 0000000..82d20f7 --- /dev/null +++ b/tests/testthat/test_max_twa.R @@ -0,0 +1,11 @@ +library(pfm) +context("Check max_twa for parent mkinfit models against analytical solutions") + +test_that("max_twa for simple decline curves is correct", { + fits <- mmkin(c("SFO", "FOMC", "DFOP"), list(FOCUS_2006_C), cores = 1, quiet = TRUE) + max_twa_21_analytical <- sapply(fits, max_twa, 21) + names(max_twa_21_analytical) <- rep("parent", 3) + preds <- lapply(fits, one_box) + max_twa_21_preds <- sapply(preds, function(x) max_twa(x, 21)[["max"]]) + expect_equal(max_twa_21_analytical, max_twa_21_preds, tolerance = .03, scale = 1) +}) |