tests/testthat/test-chk-matrix.R

test_that("vld_matrix", {
  expect_false(vld_matrix(1))
  expect_false(vld_matrix(array(1)))
  expect_true(vld_matrix(matrix()))
  expect_true(vld_matrix(matrix(NA)))
  expect_true(vld_matrix(matrix(1)))
})

test_that("chk_matrix", {
  expect_identical(chk_matrix(matrix(1)), matrix(1))
  expect_invisible(chk_matrix(matrix(1)))
  expect_chk_error(
    chk_matrix(1),
    "^`1` must be an matrix[.]$"
  )
})
poissonconsulting/chk documentation built on Jan. 29, 2025, 12:35 a.m.