prop-test 0.1.1

Formattable proptest macro
Documentation
  • Coverage
  • 25%
    1 out of 4 items documented1 out of 1 items with examples
  • Size
  • Source code size: 26.64 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 59.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 39s Average build duration of successful builds.
  • all releases: 39s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • 2xst/prop-test
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • grimerssy

Prop-test

Utility for the proptest crate, which provides a macro that is formattable with rustfmt.

Unlike the original proptest!() macro, this macro isn't expected to "wrap" test functions but is instead intended to be placed as expressions within them.

Example

fn reverse<T: Clone>(xs: &[T]) -> Vec<T> {
    xs.iter().rev().cloned().collect()
}

use prop_test::prelude::*;

// This expression would be inside of a `#[test]` function
prop_test!(&prop::collection::vec(any::<i32>(), 0..100), |xs| {
    prop_assert_eq!(&xs, &reverse(&reverse(&xs)));
    Ok(())
});