tests/testthat/test-block_mean.R

test_matrix <- matrix(c(1, 3, 5, 7, 9, 11, 13, 15, 17), 
                    byrow = TRUE, ncol = 3)
n <- 3
nov <- 1

Y <- matrix(c(7,9,11),byrow = FALSE ,ncol = 3)
samples <- matrix(c(2))

test_output <- list(Y = Y, samples = samples)

test_that("function works", {
  expect_equal(block_mean(test_matrix, n = n, nov = nov), test_output)
})


test_matrix_2 <- matrix("summer",2)



test_that("function warning", {
  expect_error(block_mean(test_matrix_2, n=3, nov = 1), "subscript out of bounds")
})

Try the tagtools package in your browser

Any scripts or data that you put into this service are public.

tagtools documentation built on June 28, 2024, 5:07 p.m.