about summary refs log tree commit diff
path: root/src/libcoretest/num
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcoretest/num')
-rw-r--r--src/libcoretest/num/int_macros.rs1
-rw-r--r--src/libcoretest/num/mod.rs12
-rw-r--r--src/libcoretest/num/uint_macros.rs1
3 files changed, 12 insertions, 2 deletions
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs
index 51af2e2916d..a1b096bf454 100644
--- a/src/libcoretest/num/int_macros.rs
+++ b/src/libcoretest/num/int_macros.rs
@@ -15,6 +15,7 @@ macro_rules! int_module (($T:ty, $T_i:ident) => (
 mod tests {
     use core::$T_i::*;
     use core::int;
+    use core::num::Int;
     use num;
 
     #[test]
diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs
index 51a44ef4d59..38502321c1d 100644
--- a/src/libcoretest/num/mod.rs
+++ b/src/libcoretest/num/mod.rs
@@ -8,7 +8,10 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use core::num::cast;
+use core::cmp::PartialEq;
+use core::fmt::Show;
+use core::num::{NumCast, cast};
+use core::ops::{Add, Sub, Mul, Div, Rem};
 
 mod int_macros;
 mod i8;
@@ -24,7 +27,12 @@ mod u64;
 mod uint;
 
 /// Helper function for testing numeric operations
-pub fn test_num<T: Int + ::std::fmt::Show>(ten: T, two: T) {
+pub fn test_num<T>(ten: T, two: T) where
+    T: PartialEq + NumCast
+     + Add<T, T> + Sub<T, T>
+     + Mul<T, T> + Div<T, T>
+     + Rem<T, T> + Show
+{
     assert_eq!(ten.add(&two),  cast(12i).unwrap());
     assert_eq!(ten.sub(&two),  cast(8i).unwrap());
     assert_eq!(ten.mul(&two),  cast(20i).unwrap());
diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs
index 1d3f1718d72..01a88119b64 100644
--- a/src/libcoretest/num/uint_macros.rs
+++ b/src/libcoretest/num/uint_macros.rs
@@ -14,6 +14,7 @@ macro_rules! uint_module (($T:ty, $T_i:ident) => (
 #[cfg(test)]
 mod tests {
     use core::$T_i::*;
+    use core::num::Int;
     use num;
 
     #[test]