aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-04-22 16:09:53 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-04-22 18:01:26 +0200
commitae4ca17b89047052b35acee8e636ff8f31636c13 (patch)
tree8d44949bc8b2a2c23a2e2896e12ff438252a1fe5 /tests
parentf6b6ecd0f925799aaced3fb5ceb9e5817a99d884 (diff)
Support SFORB with formation fractions
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/FOCUS_2006_D.csf2
-rw-r--r--tests/testthat/test_SFORB.R18
-rw-r--r--tests/testthat/test_mkinfit_errors.R3
-rw-r--r--tests/testthat/test_mkinmod.R4
4 files changed, 21 insertions, 6 deletions
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index 81a4ed74..8faa19db 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: 2020-04-20
+Date: 2020-04-22
Optimiser: IRLS
[Data]
diff --git a/tests/testthat/test_SFORB.R b/tests/testthat/test_SFORB.R
index b168a4ee..ad9881a8 100644
--- a/tests/testthat/test_SFORB.R
+++ b/tests/testthat/test_SFORB.R
@@ -9,4 +9,22 @@ test_that("Fitting the SFORB model is equivalent to fitting DFOP", {
expect_match(s_sforb, "Estimated Eigenvalues of SFORB model\\(s\\):")
expect_match(s_sforb, "parent_b1 parent_b2")
expect_match(s_sforb, "0.45956 *0.01785")
+
+ DFOP_SFO <- mkinmod(parent = mkinsub("DFOP", "M1"),
+ M1 = mkinsub("SFO"),
+ use_of_ff = "max", quiet = TRUE)
+ SFORB_SFO <- mkinmod(parent = mkinsub("SFORB", "M1"),
+ M1 = mkinsub("SFO"),
+ use_of_ff = "max", quiet = TRUE)
+
+ SFORB_SFO$coefmat
+
+ f_dfop_sfo <- mkinfit(DFOP_SFO, DFOP_par_c, quiet = TRUE)
+ f_sforb_sfo <- mkinfit(SFORB_SFO, DFOP_par_c, quiet = TRUE)
+ f_sforb_sfo_eigen <- mkinfit(SFORB_SFO, DFOP_par_c, solution_type = "eigen", quiet = TRUE)
+
+ expect_equivalent(endpoints(f_sforb_sfo)$distimes, endpoints(f_dfop_sfo)$distimes,
+ tolerance = 1e-6)
+ expect_equivalent(endpoints(f_sforb_sfo_eigen)$distimes, endpoints(f_dfop_sfo)$distimes,
+ tolerance = 1e-6)
})
diff --git a/tests/testthat/test_mkinfit_errors.R b/tests/testthat/test_mkinfit_errors.R
index 7987d291..940e0b2e 100644
--- a/tests/testthat/test_mkinfit_errors.R
+++ b/tests/testthat/test_mkinfit_errors.R
@@ -7,6 +7,7 @@ test_that("mkinfit stops to prevent and/or explain user errors", {
# We remove zero observations from FOCUS_2006_D beforehand in
# order to avoid another expect_warning in the code
FOCUS_2006_D <- subset(FOCUS_2006_D, value != 0)
+
# We get a warning if we use transform_fractions = FALSE with formation fractions
# and an error if any pathway to sink is turned off as well
expect_warning(
@@ -14,7 +15,7 @@ test_that("mkinfit stops to prevent and/or explain user errors", {
mkinfit(SFO_SFO.ff.nosink, FOCUS_2006_D, transform_fractions = FALSE, quiet = TRUE),
"turn off pathways to sink"
),
- "sum of formation fractions")
+ "sum of formation fractions may exceed one")
expect_error(mkinfit(SFO_SFO.ff, FOCUS_2006_D, transform_fractions = TRUE,
parms.ini = c(f_parent_to_m1 = 0.5), fixed_parms = "f_parent_to_m1", quiet = TRUE),
diff --git a/tests/testthat/test_mkinmod.R b/tests/testthat/test_mkinmod.R
index 1bdf094b..3178186a 100644
--- a/tests/testthat/test_mkinmod.R
+++ b/tests/testthat/test_mkinmod.R
@@ -20,10 +20,6 @@ test_that("mkinmod stops to prevent and/or explain user errors", {
expect_error(mkinmod(parent = mkinsub("IORE", "m1"),
m1 = mkinsub("SFO"), use_of_ff = "min"),
"only supported with formation fractions")
-
- expect_error(mkinmod(parent = mkinsub("SFORB", "m1"),
- m1 = mkinsub("SFO"), use_of_ff = "max"),
- "not supported")
})
test_that("Printing mkinmod models is reproducible", {

Contact - Imprint