tests/testthat/test_matrix.R

library(HMMCPP)
context("Matrix functions")

test_that("distance is zero if same",{
  A <- matrix(1:4, nrow = 2)
  B  <- A
  expect_equivalent(get_diff(A, B), 0)
}
)

test_that("Symmetric",{
  A  <- matrix(1:4, nrow = 2)
  B  <- matrix(4:1, nrow = 2)
  expect_equivalent(get_diff(A, B), get_diff(B, A))
})

test_that("Gives correct value",{
  A  <- matrix(rep(1, 4), nrow = 2)
  B  <- matrix(rep(0, 4), nrow = 2)
  expect_equal(get_diff(A, B), 2)
})
jonotuke/HMMCPP documentation built on May 19, 2019, 8:34 p.m.