diff options
| author | Martin Hořeňovský | 2023-02-26 00:14:32 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-02-26 00:14:32 +0100 |
| commit | 6fbb3f07235311d0c228b17b52406343a7aed8f2 (patch) | |
| tree | 9c1d0397f24cef4b8db3b27e85beea113ec8773a /docs | |
| parent | 9ff3cde87b1d8c61d2d97c34bdc71f0ec0a34a9c (diff) | |
| download | catch3-6fbb3f07235311d0c228b17b52406343a7aed8f2.tar.gz | |
Add IsNaN matcher
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/matchers.md | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/matchers.md b/docs/matchers.md index dda49110..d2a2f3c1 100644 --- a/docs/matchers.md +++ b/docs/matchers.md @@ -141,18 +141,27 @@ are a permutation of the ones in `some_vec`. ### Floating point matchers -Catch2 provides 3 matchers that target floating point numbers. These +Catch2 provides 4 matchers that target floating point numbers. These are: * `WithinAbs(double target, double margin)`, * `WithinULP(FloatingPoint target, uint64_t maxUlpDiff)`, and * `WithinRel(FloatingPoint target, FloatingPoint eps)`. +* `IsNaN()` > `WithinRel` matcher was introduced in Catch2 2.10.0 -For more details, read [the docs on comparing floating point +> `IsNaN` matcher was introduced in Catch2 X.Y.Z. + +The first three serve to compare two floating pointe numbers. For more +details about how they work, read [the docs on comparing floating point numbers](comparing-floating-point-numbers.md#floating-point-matchers). +`IsNaN` then does exactly what it says on the tin. It matches the input +if it is a NaN (Not a Number). The advantage of using it over just plain +`REQUIRE(std::isnan(x))`, is that if the check fails, with `REQUIRE` you +won't see the value of `x`, but with `REQUIRE_THAT(x, IsNaN())`, you will. + ### Miscellaneous matchers |