| Crates.io | assert-within |
| lib.rs | assert-within |
| version | 0.1.4 |
| created_at | 2025-04-17 01:00:17.014554+00 |
| updated_at | 2025-12-19 00:17:06.880305+00 |
| description | Macro for testing that (generic) floating point numbers are within some tolerance |
| homepage | |
| repository | https://github.com/cbeck88/assert-within |
| max_upload_size | |
| id | 1637107 |
| size | 9,357 |
A macro assert_within! for tests involving floating point numbers.
assert_within!(+0.001, val, target, "Value was not within additive 0.001: {more} {context}");
assert_within!(~0.05, val, target, "Value was not within 5% of target: {additional} {information:?}");
+, ~) indicate additive or relative errornum_traits::FloatCoreno_std compatibleMIT or Apache 2.0 at your option.