expect_that
.test_that(desc, code)
When run from the command line, tests return NULL
if all
expectations are met, otherwise it raises an error.
test_that("trigonometric functions match identities", {
expect_that(sin(pi / 4), equals(1 / sqrt(2)))
expect_that(cos(pi / 4), equals(1 / sqrt(2)))
expect_that(tan(pi / 4), equals(1))
})
# Failing test:
test_that("trigonometric functions match identities", {
expect_that(sin(pi / 4), equals(1))
})
Run the code above in your browser using DataLab