aboutsummaryrefslogtreecommitdiff
path: root/pkg/tests/testthat/test_TOXSWA_cwa.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_TOXSWA_cwa.R
parent8ffbc49b3f01deac6f9e83aaa6d318d4e2f8552b (diff)
Add simplest PEC soil calcs, use testthat
Diffstat (limited to 'pkg/tests/testthat/test_TOXSWA_cwa.R')
-rw-r--r--pkg/tests/testthat/test_TOXSWA_cwa.R25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/tests/testthat/test_TOXSWA_cwa.R b/pkg/tests/testthat/test_TOXSWA_cwa.R
new file mode 100644
index 0000000..d91b79a
--- /dev/null
+++ b/pkg/tests/testthat/test_TOXSWA_cwa.R
@@ -0,0 +1,25 @@
+library(pfm)
+context("Read and analyse TOXSWA cwa files")
+
+test_that("TOXSWA cwa file is correctly read", {
+ H_sw_D4_pond <- read.TOXSWA_cwa("00001p_pa.cwa",
+ basedir = "SwashProjects/project_H_sw/TOXSWA",
+ zipfile = system.file("testdata/SwashProjects.zip",
+ package = "pfm"))
+ expect_equal_to_reference(H_sw_D4_pond, file = "H_sw_D4_pond.rds")
+})
+
+test_that("Getting events and moving window analysis works", {
+ H_sw_R1_stream <- read.TOXSWA_cwa("00003s_pa.cwa",
+ basedir = "SwashProjects/project_H_sw/TOXSWA",
+ zipfile = system.file("testdata/SwashProjects.zip",
+ package = "pfm"))
+
+ # Event analysis with two different thresholds
+ H_sw_R1_stream$get_events(c(2, 10))
+ expect_equal_to_reference(H_sw_R1_stream$events, file = "H_sw_R1_stream_events.rds")
+
+ # Moving window analysis
+ H_sw_R1_stream$moving_windows(c(7, 21))
+ expect_equal_to_reference(H_sw_R1_stream$windows, file = "H_sw_R1_stream_windows.rds")
+})

Contact - Imprint