assertThat: Generalised Validation Functions

Description Usage Arguments Value See Also Examples

Description

These functions are generalised and simplified based on the package checkmate. They are used primarily for the function makeChecks that automatically generates checkmate-style custom validation functions.

Usage

1
2
3
4
5
6
7
assertThat(x, cond, errormsg)

checkThat(cond, errormsg)

testThat(cond)

isThat(cond)

Arguments

x

Object to perform checks on

cond

Boolean condition to check

errormsg

Error message to produce

Value

assertThat returns self invisibly if checks pass, otherwise error

checkThat returns TRUE if checks pass, otherwise error message as string

testThat returns TRUE if checks pass, otherwise FALSE

isThat returns TRUE if checks pass, otherwise FALSE

See Also

assert

Examples

1
2
3
4
5
6
7
x = 1:10
cond = inherits(x, "integer")
errormsg = "Not integer"
assertThat(x, cond, errormsg)
checkThat(cond, errormsg)
testThat(cond)
isThat(cond)

RaphaelS1/RSmisc documentation built on June 7, 2019, 8:20 p.m.