uchecks: Checking RNG Differences in Unit Tests

Description Usage Arguments Examples

Description

checkRNG checks if two objects have the same RNG settings and should be used in unit tests, e.g., with the RUnit package.

Usage

1
  checkRNG(x, y = getRNG(), ...)

Arguments

x,y

objects from which RNG settings are extracted.

...

extra arguments passed to rng.equal.

Examples

1
2
3
4
5
# check for differences in RNG
set.seed(123)
checkRNG(123)
try( checkRNG(123, 123) )
try( checkRNG(123, 1:3) )

Example output

Loading required package: pkgmaker
Loading required package: registry

Attaching package: 'pkgmaker'

The following object is masked from 'package:base':

    isNamespaceLoaded

Using RUnit framework provider: RUnit
[1] TRUE
[1] TRUE
Error in checkTrue(rng.equal(x, y), ...) : Test not TRUE

rngtools documentation built on May 2, 2019, 5 p.m.