Macro proptest::prelude::prop_assert_eq[][src]

macro_rules! prop_assert_eq {
    ($left:expr, $right:expr) => { ... };
    ($left:expr, $right:expr, $fmt:tt $($args:tt)*) => { ... };
}

Similar to assert_eq! from std, but returns a test failure instead of panicking if the condition fails.

See prop_assert! for a more in-depth discussion.

Example

use proptest::prelude::*;

proptest! {
  #[test]
  fn concat_string_length(ref a in ".*", ref b in ".*") {
    let cat = format!("{}{}", a, b);
    // Use with default message
    prop_assert_eq!(a.len() + b.len(), cat.len());
    // Can also provide custom message (added after the normal
    // assertion message)
    prop_assert_eq!(a.len() + b.len(), cat.len(),
                    "a = {:?}, b = {:?}", a, b);
  }
}