aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat/test_nafta.R
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat/test_nafta.R')
-rw-r--r--tests/testthat/test_nafta.R28
1 files changed, 24 insertions, 4 deletions
diff --git a/tests/testthat/test_nafta.R b/tests/testthat/test_nafta.R
index 10de3ce0..a50d8f36 100644
--- a/tests/testthat/test_nafta.R
+++ b/tests/testthat/test_nafta.R
@@ -21,13 +21,33 @@ context("Evaluations according to 2015 NAFTA guidance")
test_that("Data for more than one compound are rejected",
expect_error(nafta(FOCUS_2006_D)))
+test_that("Test data from Appendix B are correctly evaluated", {
+ expect_message(res <- nafta(NAFTA_SOP_Appendix_B, "aerobic aquatic"))
+
+ # From Figure D.1
+ dtx_sop <- matrix(c(2.74, 1.37, 2.17, 9.1, 28.5, 39.9), nrow = 3, ncol = 2)
+ expect_equivalent(signif(res$distimes[, 1:2], 3), dtx_sop)
+
+ C0_sop <- c(SFO = 51.2, IORE = 51.7, DFOP = 51.7)
+ C0_mkin <- sapply(res$parameters, function(x) x["parent_0", "Estimate"])
+ expect_equivalent(C0_mkin, C0_sop, scale = 1, tolerance = 0.1)
+
+ expect_equal(signif(res$S_c, 3), 26.9)
+ expect_equal(signif(res$S[["SFO"]], 3), 174)
+ expect_equal(signif(res$t_rep, 3), 8.57)
+
+ expect_known_output(print(res), "NAFTA_SOP_Appendix_B.txt")
+
+ plot_nafta <- function() plot(res)
+ vdiffr::expect_doppelganger("NAFTA SOP Appendix B", plot_nafta)
+})
+
test_that("Test data from Appendix D are correctly evaluated", {
- expect_message(res <- nafta(MRID_555555, "MRID 555555"))
+ expect_message(res <- nafta(NAFTA_SOP_Appendix_D, "MRID 555555"))
# From Figure D.1
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)
+ expect_equivalent(round(res$distimes[, 1:2]), dtx_sop)
C0_sop <- c(SFO = 83.8, IORE = 96.9, DFOP = 97.6)
C0_mkin <- sapply(res$parameters, function(x) x["parent_0", "Estimate"])
@@ -37,7 +57,7 @@ test_that("Test data from Appendix D are correctly evaluated", {
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")
+ expect_known_output(print(res), "NAFTA_SOP_Appendix_D.txt")
plot_nafta <- function() plot(res)
vdiffr::expect_doppelganger("Plot NAFTA analysis", plot_nafta)

Contact - Imprint