ttm_expect_equal {testthatmulti} | R Documentation |
Test that multi: expect equal
Description
Test that multi: expect equal
Usage
ttm_expect_equal(
object,
expected,
...,
tolerance = if (testthat::edition_get() >= 3) testthat::testthat_tolerance(),
info = NULL,
label = NULL,
expected.label = NULL,
verbose = 0
)
Arguments
object |
Object to check if equal to expected |
expected |
Expected value |
... |
Args passed to testthat::expect_equal() |
tolerance |
Passed to 'testthat::expect_true()'. |
info |
Passed to 'testthat::expect_true()'. |
label |
Passed to 'testthat::expect_true()'. |
expected.label |
Passed to 'testthat::expect_true()'. |
verbose |
Amount of info that should be printed. |
Value
Test result
Examples
set.seed(0)
# 1 attempt, all pass
ttm(1, {
ttm_expect_equal(TRUE, TRUE)
ttm_expect_equal(1, 1)
ttm_expect_equal(1:5, 1:5)
})
# Fails first 6 times, then passes
ttm(100, {
x <- sample(1:6, 1)
print(x)
ttm_expect_equal(x, 3)
})
# Will always fail regardless of number of attempts
try({
ttm(3, {
ttm_expect_equal(1, 2)
})
})
[Package testthatmulti version 0.1.0 Index]