aboutsummaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2020-12-09 14:43:40 +0100
committerJohannes Ranke <jranke@uni-bremen.de>2020-12-09 14:43:40 +0100
commitb3488f035af01627e2c5ea8bee06b7af7202636e (patch)
treefa83a8bc5d27e8006664e6d4d9d278df94ba887f /tests/testthat
parent396a92a9c856be554d785daffd8a34b9b26b8640 (diff)
And more
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/experimental_data_for_UBA_2019_mkindsg.txt5
-rw-r--r--tests/testthat/test_f_time_norm.R5
-rw-r--r--tests/testthat/test_mkinds.R7
3 files changed, 16 insertions, 1 deletions
diff --git a/tests/testthat/experimental_data_for_UBA_2019_mkindsg.txt b/tests/testthat/experimental_data_for_UBA_2019_mkindsg.txt
new file mode 100644
index 00000000..f9287b35
--- /dev/null
+++ b/tests/testthat/experimental_data_for_UBA_2019_mkindsg.txt
@@ -0,0 +1,5 @@
+<mkindsg> holding 5 mkinds objects
+Title $title: Experimental X
+Occurrene of observed compounds $observed_n:
+parent A1
+ 5 5
diff --git a/tests/testthat/test_f_time_norm.R b/tests/testthat/test_f_time_norm.R
index 790cce8b..f9aba58a 100644
--- a/tests/testthat/test_f_time_norm.R
+++ b/tests/testthat/test_f_time_norm.R
@@ -4,3 +4,8 @@ test_that("Simple temperature and moisture normalisation works", {
expect_equal(round(f_time_norm_focus(25, 20, 25), 2), 1.37)
})
+test_that("Time step normalisation for a dataset works", {
+ expect_output(f_time_norm_focus(D24_2014, study_moisture_ref_source = "focus", f_na = 1),
+ "was set to")
+ expect_equal(round(D24_2014$f_time_norm, 3), c(1.606, 0.712, 0.716, 0.716, 0.898))
+})
diff --git a/tests/testthat/test_mkinds.R b/tests/testthat/test_mkinds.R
index cb0d2686..5ce3619b 100644
--- a/tests/testthat/test_mkinds.R
+++ b/tests/testthat/test_mkinds.R
@@ -1,6 +1,11 @@
-context("Test dataset class mkinds used in gmkin")
+context("Test dataset classes mkinds and mkindsg")
test_that("An mkinds object can be created and printed", {
testdata <- mkinds$new("FOCUS C", data = FOCUS_2006_C, time_unit = "days", unit = "%AR")
expect_known_output(print(testdata), "FOCUS_2006_C_mkinds.txt")
})
+
+test_that("An mkindsg object can be created and printed", {
+ testdata_group <- mkindsg$new("Experimental X", experimental_data_for_UBA_2019[6:10])
+ expect_known_output(print(testdata_group), "experimental_data_for_UBA_2019_mkindsg.txt")
+})

Contact - Imprint