| is_identical_to {testthat} | R Documentation |
Comparison performed using identical.
is_identical_to(expected, label = NULL)
expect_identical(object, expected, info = NULL,
label = NULL, expected.label = NULL)
expected |
Expected value |
label |
For full form, label of expected object used
in error messages. Useful to override default (deparsed
expected expression) when doing tests in a loop. For
short cut form, object label. When |
object |
object to test |
info |
extra information to be included in the message (useful when writing tests in loops). |
expected.label |
Equivalent of |
Other expectations: equals,
expect_equal,
expect_equivalent,
expect_error, expect_false,
expect_is, expect_match,
expect_message,
expect_output, expect_true,
expect_warning,
gives_warning, is_a,
is_equivalent_to, is_false,
is_true, matches,
prints_text, shows_message,
takes_less_than, throws_error
a <- letters[1:3]
expect_that(a, is_identical_to(c("a", "b", "c")))
expect_identical(a, c("a", "b", "c"))
# Identical does not take into account numeric tolerance
## Not run:
expect_that(sqrt(2) ^ 2, is_identical_to(2))
expect_identical(sqrt(2) ^ 2, 2)
## End(Not run)