Skip to content

Commit

Permalink
Add assert_approx_eq
Browse files Browse the repository at this point in the history
  • Loading branch information
joelparkerhenderson committed Oct 2, 2024
1 parent ae9634d commit eb82eb2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions help/comparisons/assert_approx_eq/README.md
25 changes: 25 additions & 0 deletions help/comparisons/assert_approx_eq/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Comparisons: assert_approx_eq

https://crates.io/crates/assert_approx_eq

The `assert_approx_eq` crate provides the `assert_approx_eq` macro. The `assertables` crate has a deliberately-similar macro because we want to make it easy to migrate.

Both crates have the same syntax for a comparison that uses the default delta:

```rust
assert_approx_eq!(a, b); // default delta is 1.0e-6
```

The `assert_approx_eq` crate uses an optional delta such as:

```rust
assert_approx_eq!(a, b, 1); // delta is 1
```

The `assertables` crate uses an explicit macro name with a delta:

```rust
assert_in_delta!(a, b, 1); // delta is 1
```

We prefer the explicit macro name, rather than a form with an optional delta

0 comments on commit eb82eb2

Please sign in to comment.