tests/testthat/test_IsSingular.R

#' ---
#' title: "Test: IsSingular"
#' author: "Ivan Jacob Agaloos Pesigan"
#' date: "`r Sys.Date()`"
#' output: rmarkdown::html_vignette
#' vignette: >
#'   %\VignetteIndexEntry{Test: IsSingular}
#'   %\VignetteEngine{knitr::rmarkdown}
#'   %\VignetteEncoding{UTF-8}
#' ---
#'
#+ knitr_options, include=FALSE, cache=FALSE
knitr::opts_chunk$set(
  error = TRUE,
  collapse = TRUE,
  comment = "#>",
  out.width = "100%"
)
#'
#+ setup
library(testthat)
library(matrixR)
context("Test IsSingular.")
#'
#+ testthat
test_that("TRUE.", {
  expect_true(
    IsSingular(matrix(1, nrow = 2, ncol = 2))
  )
})
test_that("FALSE.", {
  expect_false(
    IsSingular(diag(2))
  )
  # to cover OTHERWISE
  expect_false(
    IsSingular(matrix(1:10, ncol = 2))
  )
})
jeksterslab/matrixR documentation built on Feb. 22, 2021, 8:10 a.m.