binregtest: Binary regression test

Description Usage Arguments Value Author(s) See Also Examples

Description

This function compares to parallel implementations of the same function for equality with respect to all (defined) parameter combinations.

Usage

1
binregtest(FUN1, FUN2, ..., PARS = NULL, PAR1 = NULL, PAR2 = NULL, WHICH = sample(1:n), TRYALL = TRUE, COMP = is.all.equal, NAME = "UNNAMED binregtest", VERBOSE = FALSE)

Arguments

FUN1

first function

FUN2

second function

...

common arguments, each specified as a list

PARS

list of common arguments, each specified as a list, helps to use argument names that are used by binregtest itself

PAR1

optional parameters only handed over to FUN1 (default NULL)

PAR2

optional parameters only handed over to FUN2 (default NULL)

WHICH

optional integer vector defining a subset of the possible parameter combinations

TRYALL

FALSE to interrupt testing once an error has been found (default TRUE tests everything)

COMP

function to compare results (default is.all.equal)

NAME

character scalar describing this regression test

VERBOSE

TRUE to verbose all tests (default FALSE)

Value

TRUE if all tests were successful, FALSE otherwise

Author(s)

Jens Oehlschl<e4>gel

See Also

try, is.all.equal

Examples

1
2
3
4
5
6
7
wronglog <- function(x, base=exp(1)){
  if (x>0)
    log(x, base=base)
  else
    NA
}
binregtest(wronglog, log, x=as.list(0:3), base=list(2, exp(1), 10))

Example output

Warning message:
In fun(libname, pkgname) :
  package regtest is under development and still may change considerably


UNNAMED binregtest
difference between FUN1 wronglog PAR1 NULL and FUN2 log PAR2 NULL 
function (x, base = exp(1))  
 NULL
function (x, base = exp(1))  
 NULL
common PARS
List of 2
 $ x   : int 0
 $ base: num 10
RET1
 logi NA
RET2
 num -Inf


UNNAMED binregtest
difference between FUN1 wronglog PAR1 NULL and FUN2 log PAR2 NULL 
function (x, base = exp(1))  
 NULL
function (x, base = exp(1))  
 NULL
common PARS
List of 2
 $ x   : int 0
 $ base: num 2
RET1
 logi NA
RET2
 num -Inf


UNNAMED binregtest
difference between FUN1 wronglog PAR1 NULL and FUN2 log PAR2 NULL 
function (x, base = exp(1))  
 NULL
function (x, base = exp(1))  
 NULL
common PARS
List of 2
 $ x   : int 0
 $ base: num 2.72
RET1
 logi NA
RET2
 num -Inf
[1] FALSE

regtest documentation built on May 2, 2019, 5:57 a.m.

Related to binregtest in regtest...