std::macros::assert_eq
macro_rules! assert_eq( ($given:expr , $expected:expr) => ({ let given_val = &($given); let expected_val = &($expected); // check both directions of equality.... if !((*given_val == *expected_val) && (*expected_val == *given_val)) { fail!("assertion failed: `(left == right) && (right == left)` \ (left: `{}`, right: `{}`)", *given_val, *expected_val) } }) )
Asserts that two expressions are equal to each other, testing equality in both directions.
On failure, this macro will print the values of the expressions.
Example
let a = 3; let b = 1 + 2; assert_eq!(a, b);