Skip to content

Commit 07978c8

Browse files
committed
test for helper function
1 parent 89dacb3 commit 07978c8

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
test_that("geometric mean", {
2+
3+
x <- c(1,5,4.5,2)
4+
n <- length(x)
5+
6+
res <- exp(mean(log(x)))
7+
res_prod <- prod(x)^(1/n)
8+
9+
expect_equal(res, bppg::geom_mean(x, useprod = FALSE))
10+
expect_equal(res_prod, bppg::geom_mean(x, useprod = TRUE))
11+
})

0 commit comments

Comments
 (0)