aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/testthat/test_FOCUS_D_UBA_expertise.R2
-rw-r--r--tests/testthat/test_mkinpredict_SFO_SFO.R14
2 files changed, 15 insertions, 1 deletions
diff --git a/tests/testthat/test_FOCUS_D_UBA_expertise.R b/tests/testthat/test_FOCUS_D_UBA_expertise.R
index faf473c4..323fb7b3 100644
--- a/tests/testthat/test_FOCUS_D_UBA_expertise.R
+++ b/tests/testthat/test_FOCUS_D_UBA_expertise.R
@@ -40,7 +40,7 @@ test_that("Fits without internal transformations are correct for FOCUS D", {
fit.ff.notrans <- mkinfit(SFO_SFO.ff, FOCUS_2006_D,
transform_fractions = FALSE, transform_rates = FALSE,
quiet = TRUE, solution_type = "deSolve"),
- "sum of formation fractions")
+ "The sum of formation fractions may exceed one")
expect_equivalent(round(fit.ff.notrans$bparms.optim, c(2, 4, 4, 4)),
c(99.60, 0.0987, 0.0053, 0.5145))
diff --git a/tests/testthat/test_mkinpredict_SFO_SFO.R b/tests/testthat/test_mkinpredict_SFO_SFO.R
index d0dc7cdb..bf1043a3 100644
--- a/tests/testthat/test_mkinpredict_SFO_SFO.R
+++ b/tests/testthat/test_mkinpredict_SFO_SFO.R
@@ -11,6 +11,10 @@ test_that("Variants of model predictions for SFO_SFO model give equivalent resul
m1 = mkinsub("SFO"), use_of_ff = "max", quiet = TRUE)
ot = seq(0, 100, by = 1)
+ r.1.a <- subset(as.data.frame(mkinpredict(SFO_SFO.1,
+ c(k_parent_m1 = 0.1, k_parent_sink = 0.1, k_m1_sink = 0.1),
+ c(parent = 100, m1 = 0), ot, solution_type = "analytical")),
+ time %in% c(1, 10, 50, 100))
r.1.e <- subset(as.data.frame(mkinpredict(SFO_SFO.1,
c(k_parent_m1 = 0.1, k_parent_sink = 0.1, k_m1_sink = 0.1),
c(parent = 100, m1 = 0), ot, solution_type = "eigen")),
@@ -20,6 +24,10 @@ test_that("Variants of model predictions for SFO_SFO model give equivalent resul
c(parent = 100, m1 = 0), ot, solution_type = "deSolve")),
time %in% c(1, 10, 50, 100))
+ r.2.a <- subset(as.data.frame(mkinpredict(SFO_SFO.2,
+ c(k_parent = 0.2, f_parent_to_m1 = 0.5, k_m1 = 0.1),
+ c(parent = 100, m1 = 0), ot, solution_type = "analytical")),
+ time %in% c(1, 10, 50, 100))
r.2.e <- subset(as.data.frame(mkinpredict(SFO_SFO.2,
c(k_parent = 0.2, f_parent_to_m1 = 0.5, k_m1 = 0.1),
c(parent = 100, m1 = 0), ot, solution_type = "eigen")),
@@ -29,6 +37,12 @@ test_that("Variants of model predictions for SFO_SFO model give equivalent resul
c(parent = 100, m1 = 0), ot, solution_type = "deSolve")),
time %in% c(1, 10, 50, 100))
+ # Compare analytical and deSolve for minimum use of formation fractions
+ dev.1.a_d.percent = 100 * (r.1.a[-1] - r.1.d[-1])/r.1.a[-1]
+ dev.1.a_d.percent = as.numeric(unlist((dev.1.a_d.percent)))
+ dev.1.a_d.percent = ifelse(is.na(dev.1.a_d.percent), 0, dev.1.a_d.percent)
+ expect_equivalent(dev.1.a_d.percent < tol, rep(TRUE, length(dev.1.a_d.percent)))
+
# Compare eigen and deSolve for minimum use of formation fractions
dev.1.e_d.percent = 100 * (r.1.e[-1] - r.1.d[-1])/r.1.e[-1]
dev.1.e_d.percent = as.numeric(unlist((dev.1.e_d.percent)))

Contact - Imprint