Expectation predicate for testing that the sets of two vectors are equal

expect_setequal(current, target, ..., info = NA_character_)

Arguments

current

[R vector] A vector to be tested

target

[R vector] A vector to be compared against

...

Ignored

info

[character(1L)] Optional user-defined message; must be a single string value

Value

A tinytest object. A tinytest object is a logical with attributes holding information about the test that was run

See also

testthat equivalent: testthat::expect_setequal()

Other in-condition expectation predicates: expect_contains(), expect_in(), expect_mapequal()

Examples

expect_setequal(letters, target = rev(letters)) # Pass
#> ----- PASSED      : <-->
#>  call| expect_setequal(letters, target = rev(letters)) 
expect_setequal(letters, target = "b") # Fail
#> ----- FAILED[xcpt]: <-->
#>  call| expect_setequal(letters, target = "b")
#>  diff| Expected 'current' and 'target' to be identical sets 
expect_setequal("b", target = letters) # Fail
#> ----- FAILED[xcpt]: <-->
#>  call| expect_setequal("b", target = letters)
#>  diff| Expected 'current' and 'target' to be identical sets