aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-05-09 21:18:42 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2020-05-09 21:18:42 +0200
commitefab37957381919c21d874906ce870f4941c760a (patch)
treed485fa148ec1513a0c0810780a1ed10c4f9097d2 /tests/testthat
parent47ef00e3d0a961f8fbecf0bd5da0283bed21bb96 (diff)
Avoid the call to merge for analytical solutions
This increases performance up to a factor of five!
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/FOCUS_2006_D.csf2
-rw-r--r--tests/testthat/test_analytical.R11
-rw-r--r--tests/testthat/test_tests.R2
3 files changed, 13 insertions, 2 deletions
diff --git a/tests/testthat/FOCUS_2006_D.csf b/tests/testthat/FOCUS_2006_D.csf
index f27df430..f113a668 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-05-08
+Date: 2020-05-09
Optimiser: IRLS
[Data]
diff --git a/tests/testthat/test_analytical.R b/tests/testthat/test_analytical.R
new file mode 100644
index 00000000..3d30e042
--- /dev/null
+++ b/tests/testthat/test_analytical.R
@@ -0,0 +1,11 @@
+context("Analytical solutions for coupled models")
+
+test_that("The analytical solution of SFO-SFO is correct", {
+ f_sfo_sfo.ff.analytical <- mkinfit(SFO_SFO.ff,
+ subset(FOCUS_2006_D, value != 0),
+ quiet = TRUE)
+ expect_equal(
+ parms(f_sfo_sfo.ff),
+ parms(f_sfo_sfo.ff.analytical)
+ )
+})
diff --git a/tests/testthat/test_tests.R b/tests/testthat/test_tests.R
index 3d1c136c..b7c3c548 100644
--- a/tests/testthat/test_tests.R
+++ b/tests/testthat/test_tests.R
@@ -49,7 +49,7 @@ test_that("Updating fitted models works", {
error_model = "tc", quiet = TRUE)
f_soil_1_nw <- update(f_soil_1_tc, error_model = "const")
- f_soil_1_nw_A2 <- update(f_soil_1_nw, fixed_parms = c(k_A2 = 0))
+ f_soil_1_nw_A2 <- suppressWarnings(update(f_soil_1_nw, fixed_parms = c(k_A2 = 0)))
test_nw_tc <- lrtest(f_soil_1_nw, f_soil_1_tc)
expect_equivalent(test_nw_tc[["2", "Pr(>Chisq)"]], 2.113e-6)
test_nw_A2 <- lrtest(f_soil_1_nw, f_soil_1_nw_A2)

Contact - Imprint