Skip to content

Commit

Permalink
Added a couple tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marberts committed Oct 5, 2023
1 parent e876be0 commit b79b421
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/testthat/test-elemental_index.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ test_that("Fisher calculation agrees with manual calculation", {

l <- with(ms_prices2, elemental_index(rel, period, business, r = 1.5))
p <- with(ms_prices2, elemental_index(rel, period, business, w2, r = -1.5))
all.equal(sqrt(as.matrix(l) * as.matrix(p)), as.matrix(sepr))
expect_equal(sqrt(as.matrix(l) * as.matrix(p)), as.matrix(sepr))
})

test_that("contributions add up", {
Expand All @@ -88,5 +88,6 @@ test_that("argument checking works", {
expect_error(elemental_index(1:3, 1:3, 1:3, w = 1:2))
expect_error(elemental_index(1:3, factor(1:3, levels = numeric(0))))
expect_error(elemental_index(1:3, ea = factor(1:3, levels = numeric(0))))
expect_warning(elemental_index(-1:1, r = 1))
expect_warning(elemental_index(setNames(1:3, rep(1, 3)), contrib = TRUE))
})

0 comments on commit b79b421

Please sign in to comment.