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


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