1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Macros for writing test suites.

/// Generate a test function `$name` which asserts that `$left` and `$right`
/// are equal.
///
/// # Example
///
/// ```
/// # #[macro_use] extern crate mac;
/// mod test {
/// #   // doesn't actually run the test :/
///     test_eq!(two_and_two_is_four, 2 + 2, 4);
/// }
/// # fn main() { }
/// ```
#[macro_export]
macro_rules! test_eq {
    ($name:ident, $left:expr, $right:expr) => {
        #[test]
        fn $name() {
            assert_eq!($left, $right);
        }
    }
}