expect_that(object, condition, info)
is_true
: truthis_false
: falsehoodis_a
:
inheritanceequals
: equality with numerical
toleranceis_equivalent_to
: equality ignoring
attributesis_identical_to
: exact identitymatches
: string matchingprints_text
: output matchingthrows_error
: error matchingtakes_less_than
: performance Expectations are arranged into tests with test_that
and
tests are arranged into contexts with context
.
expect_that(5 * 2, equals(10))
expect_that(sqrt(2) ^ 2, equals(2))
expect_that(sqrt(2) ^ 2, is_identical_to(2))
Run the code above in your browser using DataLab