Skip to content

Commit

Permalink
Better equivalency test
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Feb 25, 2014
1 parent 607f5d8 commit 1583003
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions inst/tests/test-array.r
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,12 @@ test_that("single column data frames work when treated as an array", {

test_that("aaply equivalent to apply with correct permutation", {
a <- matrix(seq_len(400), ncol = 20)
expect_that(rowMeans(a), equals(aaply(a, 1, mean), check.attr = FALSE))
expect_that(colMeans(a), equals(aaply(a, 2, mean), check.attr = FALSE))
expect_equivalent(rowMeans(a), aaply(a, 1, mean))
expect_equivalent(colMeans(a), aaply(a, 2, mean))

b <- structure(a, dimnames = amv_dimnames(a))
expect_that(rowMeans(b), equals(aaply(b, 1, mean), check.attr = FALSE))
expect_that(colMeans(b), equals(aaply(b, 2, mean), check.attr = FALSE))
expect_equivalent(rowMeans(b), aaply(b, 1, mean))
expect_equivalent(colMeans(b), aaply(b, 2, mean))
})

test_that("array reconstruction correct with missing cells", {
Expand Down

0 comments on commit 1583003

Please sign in to comment.