diff options
| author | Johannes Ranke <jranke@uni-bremen.de> | 2019-02-27 08:06:59 +0100 | 
|---|---|---|
| committer | Johannes Ranke <jranke@uni-bremen.de> | 2019-02-27 08:06:59 +0100 | 
| commit | c446b59e675aeff08ff7205b05f06cd81bf6dc68 (patch) | |
| tree | e02e6be6232df57e8722865b06e71af3157af891 | |
| parent | 10f2314d12bc1e1664b1ff1db015d1df9f7fbe34 (diff) | |
Fix CAKE export test to actually work
Also test the model specification via the link argument
| -rw-r--r-- | DESCRIPTION | 2 | ||||
| -rw-r--r-- | tests/testthat/FOCUS_2006_D.csf | 7 | ||||
| -rw-r--r-- | tests/testthat/FOCUS_2006_D.rds | bin | 0 -> 591 bytes | |||
| -rw-r--r-- | tests/testthat/FOCUS_2006_D.txt | 0 | ||||
| -rw-r--r-- | tests/testthat/test_CAKE_export.R | 4 | ||||
| -rw-r--r-- | tests/testthat/test_FOCUS_D_UBA_expertise.R | 3 | ||||
| -rw-r--r-- | tests/testthat/test_plots_summary_twa.R | 9 | 
7 files changed, 18 insertions, 7 deletions
| diff --git a/DESCRIPTION b/DESCRIPTION index 87823866..03346bad 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: mkin  Type: Package  Title: Kinetic Evaluation of Chemical Degradation Data  Version: 0.9.48.1 -Date: 2019-02-22 +Date: 2019-02-27  Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"),                      email = "jranke@uni-bremen.de",                      comment = c(ORCID = "0000-0003-4371-6538")), 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.rdsBinary files differ new file mode 100644 index 00000000..ff3b4f0f --- /dev/null +++ b/tests/testthat/FOCUS_2006_D.rds 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) +}) | 
