Skip to content

Commit

Permalink
Docs rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
horenmar committed Jan 21, 2023
1 parent ccb4f47 commit b5ee85d
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions docs/matchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,20 +226,14 @@ definitions to handle generic range-like types. These are:
* `Contains(T&& target_element, Comparator = std::equal_to<>{})`
* `Contains(Matcher element_matcher)`
* `AllMatch(Matcher element_matcher)`
* `AnyMatch(Matcher element_matcher)`
* `NoneMatch(Matcher element_matcher)`
* `AnyMatch(Matcher element_matcher)`
* `AllTrue()`
* `AnyTrue()`
* `NoneTrue()`
* `AnyTrue()`
* `RangeEquals(TargetRangeLike&&, Comparator = std::equal_to<>{})`
* `UnorderedRangeEquals(TargetRangeLike&&, Comparator = std::equal_to<>{})`
> `IsEmpty`, `SizeIs`, `Contains` were introduced in Catch2 3.0.1
> `All/Any/NoneMatch` were introduced in Catch2 3.0.1
> `All/Any/NoneTrue` were introduced in Catch2 3.1.0
> `RangeEquals` and `UnorderedRangeEquals` matchers were [introduced](https://github.com/catchorg/Catch2/pull/2377) in Catch2 X.Y.Z
`IsEmpty` should be self-explanatory. It successfully matches objects
Expand Down Expand Up @@ -268,17 +262,16 @@ It works for ranges of `bool`s and ranges of elements (explicitly)
convertible to `bool`.
`RangeEquals` compares the range that the matcher is constructed with
(the "target range") against the range to be tested. If the two ranges
compare equal (according to `std::equal`, which uses `operator==` to
determine equality), the match succeeds. The ranges do not need to be
the same type, and the element types do not need to be the same (e.g.
you may compare `std::vector<int>` to `std::array<char>`). The
containers do not need to be the same length.
(the "target range") against the range to be tested, element-wise. The
match succeeds if all elements from the two ranges compare equal (using
`operator==` by default). The ranges do not need to be the same type,
and the element types do not need to be the same, as long as they are
comparable. (e.g. you may compare `std::vector<int>` to `std::array<char>`).
`UnorderedRangeEquals` is similar to `RangeEquals`, but the order
does not matter. For example "1, 2, 3" would match "3, 2, 1". This
matcher succeeds if `std::is_permuation` returns true. As for
`RangeEquals`, this uses `operator==` to determine equality.
does not matter. For example "1, 2, 3" would match "3, 2, 1", but not
"1, 1, 2, 3" As with `RangeEquals`, `UnorderedRangeEquals` compares
the individual elements using using `operator==` by default.
Both `RangeEquals` and `UnorderedRangeEquals` optionally accept a
predicate which can be used to compare the containers element-wise.
Expand Down

0 comments on commit b5ee85d

Please sign in to comment.