mirror of
https://github.com/google/googletest.git
synced 2025-12-03 14:27:45 +08:00
Allow DistanceFrom() to use user-defined abs() by default.
`std::abs()` doesn't work on custom types. While one can use the 3-argument version of `DistanceFrom()` to specify how to compute the distance, it's not as convenient as defining `abs()` for the custom type once in the type's namespace and then use the 2-argument version. PiperOrigin-RevId: 735741409 Change-Id: If8fb668455eb963a2ccf089f7467c64965a2e7a6
This commit is contained in:
committed by
Copybara-Service
parent
0bdccf4aa2
commit
4ee4b17bf5
@@ -42,7 +42,7 @@ Matcher | Description
|
||||
| `Lt(value)` | `argument < value` |
|
||||
| `Ne(value)` | `argument != value` |
|
||||
| `IsFalse()` | `argument` evaluates to `false` in a Boolean context. |
|
||||
| `DistanceFrom(target, m)` | The distance between `argument` and `target` (computed by `std::abs(argument - target)`) matches `m`. |
|
||||
| `DistanceFrom(target, m)` | The distance between `argument` and `target` (computed by `abs(argument - target)`) matches `m`. |
|
||||
| `DistanceFrom(target, get_distance, m)` | The distance between `argument` and `target` (computed by `get_distance(argument, target)`) matches `m`. |
|
||||
| `IsTrue()` | `argument` evaluates to `true` in a Boolean context. |
|
||||
| `IsNull()` | `argument` is a `NULL` pointer (raw or smart). |
|
||||
|
||||
Reference in New Issue
Block a user