multiple_expect: Checks objects multiple times to see whether the produced...

Description Usage Arguments Details Examples

View source: R/utils.R

Description

The output is called multiple times, and each time the output should be the same. Especially do it for the calls running native code, best for detecting buffer overflows, memory segfaults, and so on.

Usage

1
multiple_expect(x.call, n = 5, use.gctorture = FALSE)

Arguments

x.call

a valid R call.

n

number of times.

use.gctorture

gctorture calls gc after every allocation.

Details

Although it's safer to check code with a memory management profiler like Valgrind, the C code can be called multiple times to check if any garbage values are returned due to buffer overflow.

gctorture makes R hundred times slower. Consider choosing sane values for n when use.gctorture is TRUE.

Examples

1
2
3
4
5
6
7
## Not run: 
## this silently passes!
multiple_expect(cat('hi'), n = 5)
## Below will give error when no seed is set.
multiple_expect(rnorm(5), n = 5, use.gctorture = FALSE)

## End(Not run)

strboul/mmy documentation built on Sept. 24, 2021, 12:08 p.m.