diff options
Diffstat (limited to 'src/libstd/num/mod.rs')
| -rw-r--r-- | src/libstd/num/mod.rs | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 9aaaceb87e6..a568aafe1ed 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -161,7 +161,7 @@ mod tests { use u64; use uint; - macro_rules! test_cast_20( + macro_rules! test_cast_20 { ($_20:expr) => ({ let _20 = $_20; @@ -204,7 +204,7 @@ mod tests { assert_eq!(_20, cast(20f32).unwrap()); assert_eq!(_20, cast(20f64).unwrap()); }) - ) + } #[test] fn test_u8_cast() { test_cast_20!(20u8) } #[test] fn test_u16_cast() { test_cast_20!(20u16) } @@ -664,7 +664,7 @@ mod tests { assert_eq!(third.checked_mul(4), None); } - macro_rules! test_next_power_of_two( + macro_rules! test_next_power_of_two { ($test_name:ident, $T:ident) => ( fn $test_name() { #![test] @@ -676,15 +676,15 @@ mod tests { } } ) - ) + } - test_next_power_of_two!(test_next_power_of_two_u8, u8) - test_next_power_of_two!(test_next_power_of_two_u16, u16) - test_next_power_of_two!(test_next_power_of_two_u32, u32) - test_next_power_of_two!(test_next_power_of_two_u64, u64) - test_next_power_of_two!(test_next_power_of_two_uint, uint) + test_next_power_of_two! { test_next_power_of_two_u8, u8 } + test_next_power_of_two! { test_next_power_of_two_u16, u16 } + test_next_power_of_two! { test_next_power_of_two_u32, u32 } + test_next_power_of_two! { test_next_power_of_two_u64, u64 } + test_next_power_of_two! { test_next_power_of_two_uint, uint } - macro_rules! test_checked_next_power_of_two( + macro_rules! test_checked_next_power_of_two { ($test_name:ident, $T:ident) => ( fn $test_name() { #![test] @@ -699,13 +699,13 @@ mod tests { assert_eq!($T::MAX.checked_next_power_of_two(), None); } ) - ) + } - test_checked_next_power_of_two!(test_checked_next_power_of_two_u8, u8) - test_checked_next_power_of_two!(test_checked_next_power_of_two_u16, u16) - test_checked_next_power_of_two!(test_checked_next_power_of_two_u32, u32) - test_checked_next_power_of_two!(test_checked_next_power_of_two_u64, u64) - test_checked_next_power_of_two!(test_checked_next_power_of_two_uint, uint) + test_checked_next_power_of_two! { test_checked_next_power_of_two_u8, u8 } + test_checked_next_power_of_two! { test_checked_next_power_of_two_u16, u16 } + test_checked_next_power_of_two! { test_checked_next_power_of_two_u32, u32 } + test_checked_next_power_of_two! { test_checked_next_power_of_two_u64, u64 } + test_checked_next_power_of_two! { test_checked_next_power_of_two_uint, uint } #[deriving(PartialEq, Show)] struct Value { x: int } @@ -759,13 +759,13 @@ mod tests { let one: T = Int::one(); range(0, exp).fold(one, |acc, _| acc * base) } - macro_rules! assert_pow( + macro_rules! assert_pow { (($num:expr, $exp:expr) => $expected:expr) => {{ let result = $num.pow($exp); assert_eq!(result, $expected); assert_eq!(result, naive_pow($num, $exp)); }} - ) + } assert_pow!((3i, 0 ) => 1); assert_pow!((5i, 1 ) => 5); assert_pow!((-4i, 2 ) => 16); |
