aboutsummaryrefslogtreecommitdiff
path: root/pkg/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-02-04 18:06:15 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2016-02-04 18:06:15 +0100
commitd14923ae1ac023c8f8f5ae8b5c0884f4247f764b (patch)
tree98cbafd22f11944e26fc39126096d59c64adc2d0 /pkg/tests
parent98a706373107188496a1df295697e739e51d6b06 (diff)
Test reading .out files and close connections
Diffstat (limited to 'pkg/tests')
-rw-r--r--pkg/tests/testthat/EXSW2_R1_stream_printed.txt10
-rw-r--r--pkg/tests/testthat/test_TOXSWA_cwa.R13
2 files changed, 23 insertions, 0 deletions
diff --git a/pkg/tests/testthat/EXSW2_R1_stream_printed.txt b/pkg/tests/testthat/EXSW2_R1_stream_printed.txt
new file mode 100644
index 0000000..f4e0a10
--- /dev/null
+++ b/pkg/tests/testthat/EXSW2_R1_stream_printed.txt
@@ -0,0 +1,10 @@
+<TOXSWA_cwa> data from file 3.out segment 20
+ datetime t t_firstjan t_rel_to_max cwa_mug_per_L
+1 1978-10-01 00:30:00 0.021 273.0208 -55.292 0
+2 1978-10-01 01:30:00 0.063 273.0625 -55.250 0
+3 1978-10-01 02:30:00 0.104 273.1042 -55.209 0
+4 1978-10-01 03:30:00 0.146 273.1458 -55.167 0
+5 1978-10-01 04:30:00 0.188 273.1875 -55.125 0
+6 1978-10-01 05:30:00 0.229 273.2292 -55.084 0
+Moving window analysis
+NULL
diff --git a/pkg/tests/testthat/test_TOXSWA_cwa.R b/pkg/tests/testthat/test_TOXSWA_cwa.R
index 407a7a1..7c9a73c 100644
--- a/pkg/tests/testthat/test_TOXSWA_cwa.R
+++ b/pkg/tests/testthat/test_TOXSWA_cwa.R
@@ -12,6 +12,13 @@ H_sw_R1_stream <- read.TOXSWA_cwa("00003s_pa.cwa",
basedir = basedir_test,
zipfile = zipfile_test)
+basedir_test_2 = "SwashProjects/Project_1/TOXSWA"
+
+EXSW2_R1_stream <- read.TOXSWA_cwa("3.out",
+ basedir = basedir_test_2,
+ zipfile = zipfile_test)
+
+
test_that("TOXSWA cwa file is correctly read and printed", {
@@ -29,6 +36,12 @@ test_that("TOXSWA cwa file is correctly read and printed", {
# The basedir is not printed, therefore tested separately
expect_equal(H_sw_D4_pond$basedir, basedir_test)
+
+ EXSW2_R1_stream_printed <- capture.output(print(EXSW2_R1_stream))
+ expect_equal(EXSW2_R1_stream_printed, readLines("EXSW2_R1_stream_printed.txt"))
+
+ # The basedir is not printed, therefore tested separately
+ expect_equal(H_sw_D4_pond$basedir, basedir_test)
})
test_that("Getting events and moving window analysis works", {

Contact - Imprint