Check Status

testmath

The testmath package aims to extend functions from testthat (and waldo!) to create clear and concise unit tests for mathematical properties.

Installation

At the moment, this package is only available on Github. If you would like to install it, use:

pak::pak("stefanobarbieri4/testmath")

Usage

If you would like to access testmath’s suite of functions within your unit tests:

Functions

Below is a list of current unit tests. If you’re unsure of how to use them, they each have a help page that can be accessed via:

?expect_<property>

Example usage

library(testthat)
library(testmath)

test_that("My matrix is Symmetric Positive Definite", {
  mat <- matrix(c(2, 1, 1, 2), nrow = 2)
  expect_spd(mat)
})

Matrix Properties

Function Properties