diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2017-05-17 09:36:22 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2017-05-17 09:36:22 +0200 |
commit | 62bffd4873bc53fa9cd81336efa716b220c83e0a (patch) | |
tree | 9a247a6eddf4985148986b4f4f1060419ab90325 | |
parent | d60bb9c0b52c8e0452bfbe507e60d5f651589cc8 (diff) |
Simplify tests where possible
-rw-r--r-- | ChangeLog | 28 | ||||
-rw-r--r-- | DESCRIPTION | 2 | ||||
-rw-r--r-- | test.log | 2 | ||||
-rw-r--r-- | tests/testthat/test_step_1.R | 17 |
4 files changed, 36 insertions, 13 deletions
@@ -1,3 +1,31 @@ +commit d60bb9c0b52c8e0452bfbe507e60d5f651589cc8 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-05-16 18:57:16 +0200 + + Update static documentation + +commit 14fa47b1ea1651fc2cb7bbf0086741a8004d35ee +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-05-16 18:54:34 +0200 + + Remove external data also from git as their licence is unclear + +commit 608c4f89a2656f67ba915aab17633d41acc789a7 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-05-16 18:44:22 +0200 + + Add build and test logs to the git repo + +commit 3e26a8ab76a434c3465ea1db1b4a2a2ff3ea8ec8 +Author: Johannes Ranke <jranke@uni-bremen.de> +Date: 2017-05-16 18:40:25 +0200 + + Add TWA concentrations for days > 1, fix link + + Now we have seven test calculations for the Step 1 calculator, all + perfectly passing. This provides confidence that this is a + correct reimplementation of the Step 1 part of the Step 1/2 calculator. + commit 36036b5901223591e7e21e8b73d8cd1fb034f4cb Author: Johannes Ranke <jranke@uni-bremen.de> Date: 2017-05-16 15:43:50 +0200 diff --git a/DESCRIPTION b/DESCRIPTION index 8acf123..484970a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -2,7 +2,7 @@ Package: pfm Type: Package Title: Utilities for Pesticide Fate Modelling Version: 0.4-3 -Date: 2017-05-16 +Date: 2017-05-17 Authors@R: person("Johannes Ranke", email = "jranke@uni-bremen.de", role = c("aut", "cre", "cph")) Description: Utilities for simple calculations of predicted environmental @@ -15,7 +15,7 @@ Simple PEC soil calculations: ........... Simple PEC surface water calculations with drift entry: .. Create PELMO runs from psm files and execute them: SSSSS Actual and time weighted average concentrations for SFO kinetics: . -FOCUS Step 1 calculations: .............. +FOCUS Step 1 calculations: ......... Read and analyse TOXSWA cwa files: ....... UK drainage PEC calculations: ............ diff --git a/tests/testthat/test_step_1.R b/tests/testthat/test_step_1.R index 14045f5..2be5df8 100644 --- a/tests/testthat/test_step_1.R +++ b/tests/testthat/test_step_1.R @@ -1,6 +1,6 @@ context("FOCUS Step 1 calculations") -t_out <- c(0, 1, 2, 4) # Checking the first four days should be sufficient for Step 1 +t_out <- c(0, 1, 2, 4) # Checking the first four days is sufficient for Step 1 test_that("Results of Steps 1/2 calculator for Dummy 1 are reproduced", { dummy_1 <- chent_focus_sw(cwsat = 6000, DT50_ws = 6, Koc = 344.8) @@ -30,8 +30,7 @@ test_that("Results of Steps 1/2 calculator for Dummy 2 are reproduced", { PEC_orig_2[, "PECsed"] = c(319.77, 319.95, 311.53, 295.35) PEC_orig_2[, "TWAECsed"] = c(NA, 319.86, 317.79, 310.58) - expect_equal(res_dummy_2$PEC[1:4, c(1, 2)], PEC_orig_2[, c(1, 2)], tolerance = 0.01, scale = 1) - expect_equal(res_dummy_2$PEC[1:4, c(3, 4)], PEC_orig_2[, c(3, 4)], tolerance = 0.01, scale = 1) + expect_equal(res_dummy_2$PEC[1:4, ], PEC_orig_2[, ], tolerance = 0.01, scale = 1) }) test_that("Results of Steps 1/2 calculator for Dummy 4 are reproduced", { @@ -47,8 +46,7 @@ test_that("Results of Steps 1/2 calculator for Dummy 4 are reproduced", { PEC_orig_4[, "PECsed"] = c(10.57, 11.49, 9.66, 6.83) PEC_orig_4[, "TWAECsed"] = c(NA, 11.03, 10.79, 9.48) - expect_equal(res_dummy_4$PEC[1:4, c(1, 2)], PEC_orig_4[, c(1, 2)], tolerance = 0.01, scale = 1) - expect_equal(res_dummy_4$PEC[1:4, c(3, 4)], PEC_orig_4[, c(3, 4)], tolerance = 0.01, scale = 1) + expect_equal(res_dummy_4$PEC[1:4, ], PEC_orig_4[, ], tolerance = 0.01, scale = 1) }) test_that("Results of Steps 1/2 calculator for Dummy 5 are reproduced", { @@ -64,8 +62,7 @@ test_that("Results of Steps 1/2 calculator for Dummy 5 are reproduced", { PEC_orig_5[, "PECsed"] = c(500.78, 511.28, 508.29, 502.35) PEC_orig_5[, "TWAECsed"] = c(NA, 506.03, 507.90, 506.61) - expect_equal(res_dummy_5$PEC[1:4, c(1, 2)], PEC_orig_5[, c(1, 2)], tolerance = 0.01, scale = 1) - expect_equal(res_dummy_5$PEC[1:4, c(3, 4)], PEC_orig_5[, c(3, 4)], tolerance = 0.01, scale = 1) + expect_equal(res_dummy_5$PEC[1:4, ], PEC_orig_5[, ], tolerance = 0.01, scale = 1) }) test_that("Results of Steps 1/2 calculator for Dummy 7 are reproduced", { @@ -99,8 +96,7 @@ test_that("Results of Steps 1/2 calculator for New Dummy (M1-M3) are reproduced" PEC_orig_M1[, "PECsed"] = c(31.25, 31.03, 30.82, 30.40) PEC_orig_M1[, "TWAECsed"] = c(NA, 31.14, 31.03, 30.82) - expect_equal(res_M1$PEC[1:4, c(1, 2)], PEC_orig_M1[, c(1, 2)], tolerance = 0.01, scale = 1) - expect_equal(res_M1$PEC[1:4, c(3, 4)], PEC_orig_M1[, c(3, 4)], tolerance = 0.01, scale = 1) + expect_equal(res_M1$PEC[1:4, ], PEC_orig_M1[, ], tolerance = 0.01, scale = 1) M2 <- chent_focus_sw(mw = 100, cwsat = 100, DT50_ws = 100, Koc = 50, max_ws = 0.5, max_soil = 0) res_M2 <- PEC_sw_focus(new_dummy, 1000, scenario = "cereals, winter", @@ -114,6 +110,5 @@ test_that("Results of Steps 1/2 calculator for New Dummy (M1-M3) are reproduced" PEC_orig_M2[, "PECsed"] = c(31.25, 31.89, 31.67, 31.23) PEC_orig_M2[, "TWAECsed"] = c(NA, 31.57, 31.68, 31.56) - expect_equal(res_M2$PEC[1:4, c(1, 2)], PEC_orig_M2[, c(1, 2)], tolerance = 0.01, scale = 1) - expect_equal(res_M2$PEC[1:4, c(3, 4)], PEC_orig_M2[, c(3, 4)], tolerance = 0.01, scale = 1) + expect_equal(res_M2$PEC[1:4, ], PEC_orig_M2[, ], tolerance = 0.01, scale = 1) }) |