From e18c8da322ddb11105b7fdf93e9dd538673fb946 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Sat, 27 Apr 2024 19:22:10 +0200 Subject: Fix bug in R/create_deg_func.R Closes #13 --- tests/testthat/print_dfop_saem_1.txt | 2 +- tests/testthat/summary_hfit_sfo_tc.txt | 4 ++-- tests/testthat/summary_saem_dfop_sfo_s.txt | 2 +- tests/testthat/test_water-sediment.R | 17 +++++++++++++++++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 tests/testthat/test_water-sediment.R (limited to 'tests') diff --git a/tests/testthat/print_dfop_saem_1.txt b/tests/testthat/print_dfop_saem_1.txt index f7354320..3a1f1667 100644 --- a/tests/testthat/print_dfop_saem_1.txt +++ b/tests/testthat/print_dfop_saem_1.txt @@ -18,6 +18,6 @@ log_k1 -2.71 -2.94 -2.49 log_k2 -4.14 -4.26 -4.01 g_qlogis -0.36 -0.54 -0.17 a.1 0.93 0.69 1.17 -b.1 0.05 0.04 0.06 +b.1 0.05 0.04 0.05 SD.log_k1 0.37 0.23 0.51 SD.log_k2 0.23 0.14 0.31 diff --git a/tests/testthat/summary_hfit_sfo_tc.txt b/tests/testthat/summary_hfit_sfo_tc.txt index 0618c715..ba7d1362 100644 --- a/tests/testthat/summary_hfit_sfo_tc.txt +++ b/tests/testthat/summary_hfit_sfo_tc.txt @@ -43,7 +43,7 @@ Optimised parameters: est. lower upper parent_0 92.52 89.11 95.9 log_k_parent -1.66 -2.07 -1.3 -a.1 2.03 1.60 2.5 +a.1 2.03 1.61 2.5 b.1 0.09 0.07 0.1 SD.log_k_parent 0.51 0.22 0.8 @@ -57,7 +57,7 @@ SD.log_k_parent 0.5 0.2 0.8 Variance model: est. lower upper -a.1 2.03 1.60 2.5 +a.1 2.03 1.61 2.5 b.1 0.09 0.07 0.1 Backtransformed parameters: diff --git a/tests/testthat/summary_saem_dfop_sfo_s.txt b/tests/testthat/summary_saem_dfop_sfo_s.txt index 6468ff17..a19824ce 100644 --- a/tests/testthat/summary_saem_dfop_sfo_s.txt +++ b/tests/testthat/summary_saem_dfop_sfo_s.txt @@ -86,7 +86,7 @@ SD.g 0.21 0.06 0.4 Variance model: est. lower upper -a.1 0.93 0.79 1.06 +a.1 0.93 0.80 1.06 b.1 0.05 0.05 0.06 Resulting formation fractions: diff --git a/tests/testthat/test_water-sediment.R b/tests/testthat/test_water-sediment.R new file mode 100644 index 00000000..6d5693c9 --- /dev/null +++ b/tests/testthat/test_water-sediment.R @@ -0,0 +1,17 @@ +# Issue #13 on github +water_sed_no_sed_sink <- mkinmod( + use_of_ff = "min", + water = mkinsub("SFO", "sediment"), + sediment = mkinsub("SFO", "water", sink = FALSE)) + +ws_data <- FOCUS_D +levels(ws_data$name) <- c("water", "sediment") + +test_that("An reversible reaction with the sink turned off in the second compartment works", { + # Solution method "analytical" was previously available, but erroneous + expect_error( + ws_fit_no_sed_sink <- mkinfit(water_sed_no_sed_sink, ws_data, quiet = TRUE, solution_type = "analytical"), + "Analytical solution not implemented") + ws_fit_no_sed_sink_default <- mkinfit(water_sed_no_sed_sink, ws_data, quiet = TRUE) + expect_equal(ws_fit_no_sed_sink_default$solution_type, "deSolve") +}) -- cgit v1.2.1