test_pairs

Crates.iotest_pairs
lib.rstest_pairs
version0.1.0
sourcesrc
created_at2024-10-29 18:03:37.889192
updated_at2024-10-29 18:03:37.889192
descriptionA simple testing utility that lets you test pairs
homepage
repositoryhttps://github.com/rosew0od/test_pairs
max_upload_size
id1427438
size2,752
(rosew0od)

documentation

README

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
    );
}
Commit count: 5

cargo fmt