Description Usage Arguments Details Value Author(s) See Also Examples
expect_true that current is within interval of +-magnitude around target
1 2 | expect_isOfMagnitude(target, current, orderOfMagnitudes = 1/2,
...)
|
target |
numeric vector |
current |
numeric vector (recyled) of the same length as target |
orderOfMagnitudes |
see details |
... |
further arguments passed to expect_true |
in range 10^{ log10(current)+-orderOfMagnitudes }
TRUE or error
Thomas Wutzler
1 2 3 4 5 6 7 8 9 10 11 12 | tmp <- if( requireNamespace("testthat") ){
target=1e4
expect_isOfMagnitude(1e4, 3e4) #TRUE
#try(expect_isOfMagnitude(1e4, 6e4)) #error
expect_isOfMagnitude(1e4, 5000) #TRUE
#try(expect_isOfMagnitude(1e4, 2000)) #error
expect_isOfMagnitude(1e-4, 3e-4) #TRUE
#try(expect_isOfMagnitude(1e-4, 6e-4)) #error
expect_isOfMagnitude(1e-4, 5e-5) #TRUE
#try(expect_isOfMagnitude(1e-4, 2e-5)) #error
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.