diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2016-09-27 23:00:48 +0200 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2016-09-27 23:00:48 +0200 |
commit | 12a31f4c130c551f82232d9ef7dfb608bd52c53f (patch) | |
tree | 2525ab1ea4102a6edddbd0c2f03f4a851bf2f9c5 /tests/testthat/test_geomean.R | |
parent | 0d958ab6f84b569b5437f231c56004890c4ae23b (diff) |
Reorganise repository using standard package layout
Diffstat (limited to 'tests/testthat/test_geomean.R')
-rw-r--r-- | tests/testthat/test_geomean.R | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/testthat/test_geomean.R b/tests/testthat/test_geomean.R new file mode 100644 index 0000000..0cc3416 --- /dev/null +++ b/tests/testthat/test_geomean.R @@ -0,0 +1,11 @@ +library(pfm) +context("Geometric mean calculation") + +test_that("The geometric mean is correctly calculated", { + expect_equal(geomean(c(1, 3, 9)), 3) + expect_equal(geomean(c(0, 3, 9)), 0) + expect_error(geomean(c(1, 3, NA, 9), na.rm = FALSE), "NA") + expect_equal(geomean(c(1, 3, NA, 9), na.rm = TRUE), 3) + expect_error(geomean(c(1, -3, 9)), "positive") + expect_error(geomean(c(1, -3, NA, 9)), "positive") +}) |