knitr::opts_chunk$set(
  error = TRUE,
  collapse = TRUE,
  comment = "#>",
  out.width = "100%"
)
library(testthat)
library(matrixR)
context("Test IsScalar.")
test_that("TRUE.", {
  expect_true(
    IsScalar(1)
  )
  expect_true(
    IsScalar(as.matrix(1))
  )
  # yac_symbol
  expect_true(
    IsScalar(Ryacas::ysym(1))
  )
})
test_that("FALSE.", {
  expect_false(
    IsScalar(c(1, 2, 3))
  )
  expect_false(
    IsScalar(as.matrix(c(1, 2, 3)))
  )
  # to cover OTHERWISE
  expect_false(
    IsScalar(data.frame(1))
  )
  # yac_symbol
  expect_false(
    IsScalar(Ryacas::ysym(c(1, 2, 3)))
  )
  expect_false(
    IsScalar(Ryacas::ysym(as.matrix(c(1, 2, 3))))
  )
})


jeksterslab/matrixR documentation built on Feb. 22, 2021, 8:10 a.m.