diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2018-07-11 03:41:43 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2018-07-11 03:41:43 +0200 |
commit | 03c3035ca01c66b6a1352f7e509753fe2d057af2 (patch) | |
tree | a16eb034b5a3f856ba5d48b39bed198a27b16a24 /tests | |
parent | 6aa015db8eb5e72e7c5e82ef5efced1898e75acd (diff) |
Improve PELMO tests
Diffstat (limited to 'tests')
-rw-r--r-- | tests/testthat/test_PELMO.R | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/tests/testthat/test_PELMO.R b/tests/testthat/test_PELMO.R index 49c03d3..ba6a04a 100644 --- a/tests/testthat/test_PELMO.R +++ b/tests/testthat/test_PELMO.R @@ -21,11 +21,12 @@ runs <- list( # Check if we have wine on the path wine_installed <- system('wine --version', ignore.stdout = TRUE) == 0 +skip_if_no_wine <- function() { + if (!wine_installed) skip("wine is not available") +} test_that("PELMO paths are correctly created", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() psm_paths = c( PELMO_path(runs[[1]]$psm, "fbe", "Por"), PELMO_path(runs[[2]]$psm, "pot", "Ham"), @@ -40,9 +41,7 @@ test_that("PELMO paths are correctly created", { }) test_that("PELMO runs are correctly set up", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() # Prepare runs in analogy to the test archive skip_on_cran() @@ -67,11 +66,9 @@ test_that("PELMO runs are correctly set up", { }) test_that("PELMO runs can be run and give the expected result files", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } - + skip_if_no_wine() skip_on_cran() + run_PELMO(runs, cores = 7) plm_files <- c("CHEM.PLM", "ECHO.PLM", @@ -104,14 +101,12 @@ test_that("PELMO runs can be run and give the expected result files", { } }) -pfm_PECgw <- evaluate_PELMO(runs) - test_that("PELMO runs are correctly evaluated", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } - + skip_if_no_wine() skip_on_cran() + + pfm_PECgw <- evaluate_PELMO(runs) + # Check that if output is the same as in the test archive for (run in runs) { psm <- run$psm @@ -168,10 +163,11 @@ test_that("PELMO runs are correctly evaluated", { }) test_that("PECgw from FOCUS summary files can be reproduced", { - if (!wine_installed) { - skip("A wine installation is needed for this test") - } + skip_if_no_wine() skip_on_cran() + + pfm_PECgw <- evaluate_PELMO(runs) + focus_summary <- list() for (run in runs) { |