1 | //! Macros for writing test suites. |
2 | |
3 | /// Generate a test function `$name` which asserts that `$left` and `$right` |
4 | /// are equal. |
5 | /// |
6 | /// # Example |
7 | /// |
8 | /// ``` |
9 | /// # #[macro_use ] extern crate mac; |
10 | /// mod test { |
11 | /// # // doesn't actually run the test :/ |
12 | /// test_eq!(two_and_two_is_four, 2 + 2, 4); |
13 | /// } |
14 | /// # fn main() { } |
15 | /// ``` |
16 | #[macro_export ] |
17 | macro_rules! test_eq { |
18 | ($name:ident, $left:expr, $right:expr) => { |
19 | #[test] |
20 | fn $name() { |
21 | assert_eq!($left, $right); |
22 | } |
23 | } |
24 | } |
25 | |