tests/testthat/test_o.to.m.R

test_that('Symmmetric.', {

  m = matrix(1:9, nrow = 3, ncol = 3)
  o = m[lower.tri(m)]

  m_new <- o.to.m(o)

  expect_equal(m_new[lower.tri(m_new)], m_new[upper.tri(m_new)])

})

test_that('Is matrix.', {

  m = matrix(1:9, nrow = 3, ncol = 3)
  o = m[lower.tri(m)]

  m_new <- o.to.m(o)

  expect_true(class(m_new)[1] == 'matrix')

})

test_that('Diagonal 0.', {

  m = matrix(1:9, nrow = 3, ncol = 3)
  o = m[lower.tri(m)]

  m_new <- o.to.m(o)

  expect_equal(as.numeric(diag(m_new)), rep(0, 3))

})

Try the callsync package in your browser

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

callsync documentation built on May 29, 2024, 5:30 a.m.