View Source Machete.InAnyOrderMatcher (Machete v0.3.1)

Defines a matcher that matches lists in any order

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.

Types

@opaque t()

Describes an instance of this matcher

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