| Crates.io | test_pairs |
| lib.rs | test_pairs |
| version | 0.1.0 |
| created_at | 2024-10-29 18:03:37.889192+00 |
| updated_at | 2024-10-29 18:03:37.889192+00 |
| description | A simple testing utility that lets you test pairs |
| homepage | |
| repository | https://github.com/rosew0od/test_pairs |
| max_upload_size | |
| id | 1427438 |
| size | 2,752 |
A simple testing library that allows you to test pairs. A simple example for testing that adding and subtracting are working:
#[test]
fn adding() {
let pairs = [
(0, 1),
(2, 3),
(3, 4)
];
test_pairs(
&pairs,
|a, b| a + 1,
|b, a| b - 1
);
}
If you only want to test turning a into b, but not b into a, you can simply return a:
#[test]
fn adding() {
let pairs = [
(0, 1),
(2, 3),
(3, 4)
];
test_pairs(
&pairs,
|a, b| a + 1,
|b, a| a
);
}