tests/testthat/test-blocks.R

context("Testing seriesToBlock and blockToSeries")

# load some basic data to perform tests
n <- 10
d <- 3
K <- 23
X <- matrix(runif(K*n*d), ncol = K, nrow = n*d)
Y <- rnorm(d*n)

test_that("block functions are OK", {
  expect_equal(blockToSeries(seriesToBlock(X,d)),X)
  expect_equal(seriesToBlock(blockToSeries(X),dim(X)[2]),X)
  expect_equal(blockToSeries(seriesToBlock(Y,d)),Y)
})

Try the opera package in your browser

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

opera documentation built on Dec. 11, 2021, 9:07 a.m.