aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/FOCUS_2006_D.csf7
-rw-r--r--tests/testthat/FOCUS_2006_D.rdsbin0 -> 591 bytes
-rw-r--r--tests/testthat/FOCUS_2006_D.txt0
-rw-r--r--tests/testthat/test_CAKE_export.R4
-rw-r--r--tests/testthat/test_FOCUS_D_UBA_expertise.R3
-rw-r--r--tests/testthat/test_plots_summary_twa.R9
6 files changed, 17 insertions, 6 deletions
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index 22c5f2b4..ae524e01 100644
--- a/tests/testthat/FOCUS_2006_D.csf
+++ b/tests/testthat/FOCUS_2006_D.csf
@@ -5,7 +5,7 @@ Description:
MeasurementUnits: % AR
TimeUnits: days
Comments: Created using mkin::CAKE_export
-Date: 2019-02-26
+Date: 2019-02-27
Optimiser: IRLS
[Data]
@@ -47,6 +47,11 @@ Time Parent M1
120 33.31
+[Model]
+ParentCompartment: Parent parent parent
+Compartment: M1 m1 m1
+Link: Parent M1 0.5 0 1 Free Explicit
+
[ComponentNames]
Parent:parent
M1:m1
diff --git a/tests/testthat/FOCUS_2006_D.rds b/tests/testthat/FOCUS_2006_D.rds
new file mode 100644
index 00000000..ff3b4f0f
--- /dev/null
+++ b/tests/testthat/FOCUS_2006_D.rds
Binary files differ
diff --git a/tests/testthat/FOCUS_2006_D.txt b/tests/testthat/FOCUS_2006_D.txt
deleted file mode 100644
index e69de29b..00000000
--- a/tests/testthat/FOCUS_2006_D.txt
+++ /dev/null
diff --git a/tests/testthat/test_CAKE_export.R b/tests/testthat/test_CAKE_export.R
index 5f984782..23b424fc 100644
--- a/tests/testthat/test_CAKE_export.R
+++ b/tests/testthat/test_CAKE_export.R
@@ -22,8 +22,10 @@ test_that("Exporting is reproducible", {
CAKE_export(list("FOCUS C" = FOCUS_2006_C,
"FOCUS D" = FOCUS_2006_D),
map = c(parent = "Parent", m1 = "M1"),
+ links = c(parent = "m1"),
filename = "FOCUS_2006_D.csf", overwrite = TRUE,
study = "FOCUS 2006 D")
csf <- readLines(con = "FOCUS_2006_D.csf")
- expect_known_output(csf, "FOCUS_2006_D.txt")
+ csf[8] <- "Date: Dummy date 0000-00-00"
+ expect_known_value(csf, file = "FOCUS_2006_D.rds")
})
diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R
index ff2c6f5f..42c4fcfb 100644
--- a/tests/testthat/test_FOCUS_D_UBA_expertise.R
+++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R
@@ -51,9 +51,6 @@ test_that("Fits with formation fractions are correct for FOCUS D", {
c(7.02, 23.33))
expect_equal(round(as.numeric(endpoints(fit.ff)$distimes["m1", ]), 1),
c(131.8, 437.7))
- # The following value is not from the UBA expertise, only used here
- # to check stability of the AIC calculation
- expect_equivalent(AIC(fit.ff), 212.6, scale = 1, tolerance = 0.1)
})
test_that("Fits without internal transformations are correct for FOCUS D", {
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index 5201567d..e13111bb 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -51,7 +51,6 @@ test_that("Time weighted average concentrations are correct", {
context("Summary")
test_that("The summary is reproducible", {
- skip_on_cran()
fit <- fits[["DFOP", "FOCUS_C"]]
test_summary <- summary(fit)
test_summary$fit_version <- "Dummy 0.0 for testing"
@@ -78,3 +77,11 @@ test_that("Plotting mmkin objects is reproducible", {
vdiffr::expect_doppelganger("mmkin plot for SFO (FOCUS C and D)", mmkin_SFO)
})
+context("AIC calculation")
+
+test_that("The AIC is reproducible", {
+ expect_equivalent(AIC(fits[["SFO", "FOCUS_C"]]), 59.8, scale = 1, tolerance = 0.1)
+ expect_equivalent(AIC(fits[, "FOCUS_C"]),
+ data.frame(df = c(3, 4, 5, 5), AIC = c(59.8, 44.7, 29.1, 39.3)),
+ scale = 1, tolerance = 0.1)
+})

Contact - Imprint