ttm | R Documentation |
Test that with multiple attempts
ttm(n, expr, verbose = 0)
n |
Maximum number of attempts |
expr |
Expression to evaluate |
verbose |
Amount that should be printed |
Nothing
set.seed(0)
# 1 attempt, all pass
ttm(1, {
ttm_expect_true(TRUE)
ttm_expect_true(1 == 1)
ttm_expect_true(all(1:5 == 1:5))
})
# Fails first 10 times, then passes
ttm(100, {
x <- runif(1)
print(x)
ttm_expect_true(x < 0.1)
})
# Will always fail regardless of number of attempts
try({
ttm(3, {
ttm_expect_true(1 == 2)
})
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.