checkMagnitude: checkMagnitude

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/unitTest.R

Description

checkTrue that current is within interval of +-magnitude around target

Usage

1
2
checkMagnitude(target, current, orderOfMagnitudes = 1/2, 
    ...)

Arguments

target

numeric vector

current

numeric vector (recyled) of the same length as target

orderOfMagnitudes

see details

...

further arguments passed to checkTrue

Details

in range 10^{ log10(current)+-orderOfMagnitudes }

Value

TRUE or error

Author(s)

Thomas Wutzler

See Also

twMisc checkInterval

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
if( requireNamespace("RUnit") ){
    target=1e4
    checkMagnitude(1e4, 3e4)    #TRUE
    try(checkMagnitude(1e4, 6e4))   #error
    checkMagnitude(1e4, 5000)   #TRUE
    try(checkMagnitude(1e4, 2000))  #error
    
    checkMagnitude(1e-4, 3e-4)  #TRUE
    try(checkMagnitude(1e-4, 6e-4)) #error
    checkMagnitude(1e-4, 5e-5)  #TRUE
    try(checkMagnitude(1e-4, 2e-5)) #error
}

twMisc documentation built on May 2, 2019, 6:11 p.m.