library(testit)
assert('T is bad for TRUE, and so is F for FALSE', {
T = FALSE; F = TRUE
(T != TRUE) # note the parentheses
(F != FALSE)
})
assert('A Poisson random number is non-negative', {
x = rpois(1, 10)
(x >= 0)
(x > -1)
})
# () works inside control structures too
assert('conditional test', {
if (requireNamespace('base', quietly = TRUE)) (1 + 1 == 2)
})
Run the code above in your browser using DataLab