aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRanke Johannes <johannes.ranke@agroscope.admin.ch>2024-01-31 13:28:10 +0100
committerRanke Johannes <johannes.ranke@agroscope.admin.ch>2024-01-31 13:28:10 +0100
commit7dd316f2ebc3edc321431419a02ccbd6ea47fef3 (patch)
treeb805c0630d3c1484e80da00b3738dcf8ec58c63d
parentaed160d7f0eaf5865e2bd9bf6c4b1c9d7b13d911 (diff)
Fix test to correctly generate pesticide.txt
-rw-r--r--log/test.log18
-rw-r--r--tests/testthat/test_step_1.R26
2 files changed, 34 insertions, 10 deletions
diff --git a/log/test.log b/log/test.log
new file mode 100644
index 0000000..4ff37bc
--- /dev/null
+++ b/log/test.log
@@ -0,0 +1,18 @@
+ℹ Testing pfm
+✔ | F W S OK | Context
+✔ | 7 | Exposit calculations
+✔ | 6 | Geometric mean calculation
+✔ | 1 | Check max_twa for parent mkinfit models against analytical solutions [1.4s]
+✔ | 1 | Simple PEC sediment calculations
+✔ | 17 | Simple PEC soil calculations
+✔ | 6 | Simple PEC surface water calculations with drift entry
+✔ | 1 | Actual and time weighted average concentrations for SFO kinetics
+✔ | 9 | FOCUS Step 1 calculations
+✔ | 8 | FOCUS Steps 12 input files
+✔ | 7 | Read and analyse TOXSWA cwa files [4.8s]
+✔ | 12 | UK drainage PEC calculations
+
+══ Results ═════════════════════════════════════════════════════════════════════════════════════════
+Duration: 6.8 s
+
+[ FAIL 0 | WARN 0 | SKIP 0 | PASS 75 ]
diff --git a/tests/testthat/test_step_1.R b/tests/testthat/test_step_1.R
index 23358dd..507abef 100644
--- a/tests/testthat/test_step_1.R
+++ b/tests/testthat/test_step_1.R
@@ -71,7 +71,8 @@ test_that("Results of Steps 1/2 calculator for Dummy 2 are reproduced", { # {{{1
res_dummy_2 <- PEC_sw_focus(dummy_2, 1000,
comment = "Maize, Southern Europe, spring, 1 app/season",
scenario = "maize",
- region = "s", season = "mm")
+ region = "s", season = "mm",
+ append = TRUE)
PEC_step_1_2 = PEC_template_1
@@ -87,7 +88,8 @@ test_that("Results of Steps 1/2 calculator for Dummy 4 are reproduced", { # {{{1
res_dummy_4 <- PEC_sw_focus(dummy_4, 7.5, n = 3, i = 14,
comment = "Apples, Southern Europe, spring, 3 app./season, 14 d int, orchards",
region = "s", season = "mm",
- scenario = "pome / stone fruit, early")
+ scenario = "pome / stone fruit, early",
+ append = TRUE)
PEC_step_1_4 = PEC_template_1
@@ -103,7 +105,8 @@ test_that("Results of Steps 1/2 calculator for Dummy 5 are reproduced", { # {{{1
res_dummy_5 <- PEC_sw_focus(dummy_5, 75, n = 5, i = 14,
comment = "Vines, Northern Europe, spring, 5 app/seaon 14 d int.",
region = "n", season = "mm",
- scenario = "vines, early")
+ scenario = "vines, early",
+ append = TRUE)
PEC_step_1_5 = PEC_template_1
@@ -119,7 +122,8 @@ test_that("Results of Steps 1/2 calculator for Dummy 7 are reproduced", { # {{{1
res_dummy_7 <- PEC_sw_focus(dummy_7, 750, n = 4, i = 14,
comment = "Vines, Southern Europe, spring, 4 app/seaon 14 d int.",
region = "s", season = "mm",
- scenario = "vines, early")
+ scenario = "vines, early",
+ append = TRUE)
PEC_step_1_7 = PEC_template_1
@@ -134,9 +138,10 @@ test_that("Results of Steps 1/2 calculator for Dummy 7 are reproduced", { # {{{1
test_that("Results of Steps 1/2 calculator for New Dummy (M1-M2) are reproduced", { # {{{1
res_M1 <- PEC_sw_focus(new_dummy, 1000, scenario = "cereals, winter",
- comment = "Soil Metabolite",
- region = "n", season = "of",
- met = M1)
+ comment = "Soil Metabolite",
+ region = "n", season = "of",
+ met = M1,
+ append = TRUE)
PEC_step_1_M1 = PEC_template_1
@@ -148,9 +153,10 @@ test_that("Results of Steps 1/2 calculator for New Dummy (M1-M2) are reproduced"
expect_equal(res_M1$PEC[1:4, ], PEC_step_1_M1[, ], tolerance = 0.01, scale = 1)
res_M2 <- PEC_sw_focus(new_dummy, 1000, scenario = "cereals, winter",
- comment = "Water Metabolite",
- region = "n", season = "of",
- met = M2)
+ comment = "Water Metabolite",
+ region = "n", season = "of",
+ met = M2,
+ append = TRUE)
PEC_step_1_M2 = PEC_template_1

Contact - Imprint