View Source Machete.InAnyOrderMatcher (Machete v0.2.3)

Defines a matcher that matches lists in any order

Link to this section Summary

Types

t()

Describes an instance of this matcher

Functions

Matches lists in any order. Matchers are applied in all possible orders until one matches; this can be exponentially expensive for long lists.

Link to this section Types

@opaque t()

Describes an instance of this matcher

Link to this section Functions

@spec in_any_order([Machete.Matchable.t()]) :: t()

Matches lists in any order. Matchers are applied in all possible orders until one matches; this can be exponentially expensive for long lists.

Examples:

iex> assert [1] ~> in_any_order([1])
true

iex> assert [2, 1] ~> in_any_order([1, 2])
true

iex> assert [1, "a", :a] ~> in_any_order([string(), atom(), integer()])
true

iex> refute [1, 2] ~> in_any_order([1, 3])
false