Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sarah-quinones/equator
https://github.com/sarah-quinones/equator
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sarah-quinones/equator
- Owner: sarah-quinones
- License: mit
- Created: 2023-11-19T21:08:30.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-04T01:37:06.000Z (6 months ago)
- Last Synced: 2024-10-11T17:08:18.630Z (3 months ago)
- Language: Rust
- Size: 53.7 KB
- Stars: 10
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# equator
`equator` is an assertion library that aims to provide helpful diagnostics when
multiple conditions need to be asserted at once, without short-circuiting.Valid assertions must be of the form:
- `cond` for testing a single condition,
- `all(...)` for testing that multiple conditions all hold simultaneously,
- `any(...)` for testing that at least one condition holds.`all` and `any` may be arbitrarily nested.
# Example
```
let x = 0;
let y = 1;let a = 4;
let b = 2;// `equator::debug_assert!` is also available for debug-only assertions
equator::assert!(all(x == y, a < b));
```This should panic with an error message like
```
Assertion failed at path/main.rs:8:1
Assertion failed: x == y
- x = 0
- y = 1
Assertion failed: a < b
- a = 4
- b = 2
```