Learn R Programming

testthat (version 0.3)

is_identical_to: Expectation: is the object identical to another?

Description

Expectation: is the object identical to another?

Usage

is_identical_to(expected, label)

Arguments

expected
expected value
label
label of expected object used in error messages. Useful to override default (deparsed expected expression) when doing tests in a loop.

Details

Comparison performed using identical.

Examples

Run this code
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
expect_that(sqrt(2) ^ 2, is_identical_to(2))
expect_identical(sqrt(2) ^ 2, 2)

Run the code above in your browser using DataLab