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[.]$"
  )
})

Try the chk package in your browser

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

chk documentation built on Oct. 6, 2023, 9:06 a.m.