CHNOSZ (version 1.3.2)

util.test: Functions for Writing Tests

Description

Functions modelled after the expect_ functions in testthat.

Usage

maxdiff(x, y)
  expect_maxdiff(object, expected, maxdiff = 0)

Arguments

x

numeric object

y

numeric object

object

numeric, object to test

expected

numeric, expected value

maxdiff

numeric, maximum pairwise difference between object and expected value

Details

maxdiff computes the maximum (absolute) pairwise difference between x and y, i.e. max(abs(y - x)).

expect_maxdiff tests that the maximum of the pairwise differences between two objects is less than the value of the argument maxdiff. The function uses expect to generate an expectation in the testthat framework.