From efab37957381919c21d874906ce870f4941c760a Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 9 May 2020 21:18:42 +0200 Subject: Avoid the call to merge for analytical solutions This increases performance up to a factor of five! --- tests/testthat/FOCUS_2006_D.csf | 2 +- tests/testthat/test_analytical.R | 11 +++++++++++ tests/testthat/test_tests.R | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/testthat/test_analytical.R (limited to 'tests/testthat') 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) -- cgit v1.2.1