aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/print_nafta_analysis.txt33
-rw-r--r--tests/testthat/summary_DFOP_FOCUS_C.txt2
-rw-r--r--tests/testthat/test_nafta.R9
-rw-r--r--tests/testthat/test_plots_summary_twa.R4
4 files changed, 43 insertions, 5 deletions
diff --git a/tests/testthat/print_nafta_analysis.txt b/tests/testthat/print_nafta_analysis.txt
new file mode 100644
index 00000000..61d2539f
--- /dev/null
+++ b/tests/testthat/print_nafta_analysis.txt
@@ -0,0 +1,33 @@
+Sums of squares:
+ SFO IORE DFOP
+1378.6832 615.7730 517.8836
+[1] 717.4598
+
+Parameters:
+$SFO
+ Estimate Pr(>t) Lower Upper
+parent_0 83.755751519 8.076390e-15 76.928220975 90.583282063
+k_parent_sink 0.001703321 7.452357e-05 0.001108568 0.002617164
+
+$IORE
+ Estimate Pr(>t) Lower Upper
+parent_0 9.685291e+01 NA 8.752855e+01 1.061773e+02
+k__iore_parent_sink 8.403374e-14 NA 1.092054e-19 6.466412e-08
+N_parent 6.684458e+00 NA 3.538511e+00 9.830405e+00
+
+$DFOP
+ Estimate Pr(>t) Lower Upper
+parent_0 9.755655e+01 4.439930e-13 8.884447e+01 1.062686e+02
+k1 4.240633e-02 3.554769e-02 1.414189e-02 1.271610e-01
+k2 8.237928e-04 2.060933e-02 3.172784e-04 2.138925e-03
+g 2.881037e-01 1.313715e-04 1.783967e-01 4.299694e-01
+
+
+DTx values:
+ DT50 DT90 DT50_rep
+SFO 407 1352 407
+IORE 541 5192066 1562968
+DFOP 429 2383 841
+
+Representative half-life:
+[1] 841.4096
diff --git a/tests/testthat/summary_DFOP_FOCUS_C.txt b/tests/testthat/summary_DFOP_FOCUS_C.txt
index d8a3e05a..33d55ebc 100644
--- a/tests/testthat/summary_DFOP_FOCUS_C.txt
+++ b/tests/testthat/summary_DFOP_FOCUS_C.txt
@@ -10,7 +10,7 @@ d_parent/dt = - ((k1 * g * exp(-k1 * time) + k2 * (1 - g) * exp(-k2 *
Model predictions using solution type analytical
-Fitted with method Port using 127 model solutions performed in 0.401 s
+Fitted with method Port using test 0 model solutions performed in test time 0 s
Weighting: none
diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R
index 7d650ad8..3615c278 100644
--- a/tests/testthat/test_nafta.R
+++ b/tests/testthat/test_nafta.R
@@ -16,9 +16,6 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>
-library(testthat)
-library(mkin)
-
context("Evaluations according to the NAFTA guidance from 2015")
test_that("Data for more than one compound are rejected",
@@ -31,6 +28,7 @@ test_that("Test data from Appendix D are correctly evaluated", {
dtx_sop <- matrix(c(407, 541, 429, 1352, 5192066, 2383), nrow = 3, ncol = 2)
expect_equivalent(res$distimes[, 1:2], dtx_sop, tolerance = 1,
scale = 1)
+
C0_sop <- c(SFO = 83.8, IORE = 96.9, DFOP = 97.6)
C0_mkin <- sapply(res$parameters, function(x) x["parent_0", "Estimate"])
expect_equivalent(C0_mkin, C0_sop, scale = 1, tolerance = 0.1)
@@ -38,4 +36,9 @@ test_that("Test data from Appendix D are correctly evaluated", {
expect_equal(round(res$S_c), 717)
expect_equal(signif(res$S[["SFO"]], 3), 1.38e+3)
expect_equal(round(res$t_rep), 841)
+
+ expect_known_output(print(res), "print_nafta_analysis.txt")
+
+ plot_nafta <- function() plot(res)
+ vdiffr::expect_doppelganger("Plot NAFTA analysis SOP Appendix D", plot_nafta)
})
diff --git a/tests/testthat/test_plots_summary_twa.R b/tests/testthat/test_plots_summary_twa.R
index 83a6a040..d5f4f199 100644
--- a/tests/testthat/test_plots_summary_twa.R
+++ b/tests/testthat/test_plots_summary_twa.R
@@ -53,11 +53,13 @@ context("Summary")
test_that("The summary is reproducible", {
skip_on_cran()
fit <- fits[["DFOP", "FOCUS_C"]]
- undebug(summary.mkinfit)
+ test_summary <- summary(fit)
test_summary$fit_version <- "Dummy 0.0 for testing"
test_summary$fit_Rversion <- "Dummy R version for testing"
test_summary$date.fit <- "Dummy date for testing"
test_summary$date.summary <- "Dummy date for testing"
+ test_summary$calls <- "test 0"
+ test_summary$time <- c(elapsed = "test time 0")
expect_known_output(print(test_summary), "summary_DFOP_FOCUS_C.txt")
})

Contact - Imprint