check_identical(..., type = "value", .names = get_names(...))
assert_identical(..., type = "value", .names = get_names(...))
test_identical(..., type = "value", .names = get_names(...))
Objects to compare.
(optional) a string corresponding to the type of comparison to
perform. Valid values: "value"
, "length"
, and "class"
(default:
"value"
).
(optional) a character vector
containing names for each object in ...
(default:
prettycheck:::get_names(...)
). This argument is used internally and
should not be set by the user.
test_*
: TRUE
if it passes the test; FALSE
otherwise.
check_*
: TRUE
if it passes the test; a string with a message otherwise.
assertion_*
: The same input as invisible if it passes the
test; an error message otherwise.
expect_*
: The same input as invisible if it passes the
test; an error message otherwise.
x <- 1; y <- 1
test_identical(x, y, type = "value")
#> [1] TRUE
#> [1] TRUE # Expected
x <- 1; y <- 2
check_identical(x, y, type = "value") |> cli::cli_alert_warning()
#> ! x and y must have identical values.
#> ! x and y must have identical values. # Expected
x <- letters; y <- 1:2
check_identical(x, y, type = "length") |> cli::cli_alert_warning()
#> ! x and y must have identical lengths.
#> ! x and y must have identical lengths. # Expected
x <- "a"; y <- 1
check_identical(x, y, type = "class") |> cli::cli_alert_warning()
#> ! x and y must belong to the same class.
#> ! x and y must belong to the same class. # Expected