Macro proptest::prelude::prop_assert_ne

source ·
macro_rules! prop_assert_ne {
    ($left:expr, $right:expr) => { ... };
    ($left:expr, $right:expr, $fmt:tt $($args:tt)*) => { ... };
}
Expand description

Similar to assert_ne! 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 test_addition(a in 0i32..100i32, b in 1i32..100i32) {
    // Use with default message
    prop_assert_ne!(a, a + b);
    // Can also provide custom message added after the common message
    prop_assert_ne!(a, a + b, "a = {}, b = {}", a, b);
  }
}