aboutsummaryrefslogtreecommitdiff
path: root/pkg/tests/testthat/test_PEC_soil.R
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2015-04-22 13:42:10 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2015-04-22 13:42:10 +0200
commitec79637749d300ab4ca170805c673905e52d67dd (patch)
tree6eabf636f3012daecbe7ee446b1083da86d64e63 /pkg/tests/testthat/test_PEC_soil.R
parent8ffbc49b3f01deac6f9e83aaa6d318d4e2f8552b (diff)
Add simplest PEC soil calcs, use testthat
Diffstat (limited to 'pkg/tests/testthat/test_PEC_soil.R')
-rw-r--r--pkg/tests/testthat/test_PEC_soil.R13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkg/tests/testthat/test_PEC_soil.R b/pkg/tests/testthat/test_PEC_soil.R
new file mode 100644
index 0000000..27b2eb7
--- /dev/null
+++ b/pkg/tests/testthat/test_PEC_soil.R
@@ -0,0 +1,13 @@
+library(pfm)
+context("Simple PEC soil calculations")
+
+test_that("PEC_soil calculates correctly", {
+ # Application of 100 g/ha gives 0.133 mg/kg under default assumptions
+ expect_equal(PEC_soil(100), 0.1 * 4/3)
+
+ # or 0.1 mg/kg assuming 25% interception
+ expect_equal(PEC_soil(100, interception = 0.25), 0.1)
+
+ # Mixing depth of 1 cm gives five-fold PEC
+ expect_equal(PEC_soil(100, interception = 0.25, mixing_depth = 1), 0.5)
+})

Contact - Imprint