about summary refs log tree commit diff
path: root/src/libcoretest
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-01 18:04:46 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-13 20:15:39 -0500
commit1ec5650ad3a95d6ebdcaa21b87fb2d0f5423f0ba (patch)
tree6af17d052ab190e72d50abeec07b4f260e252ff8 /src/libcoretest
parenta672b27cbc8de4f3cb6e5f2b3ed5a473204680b7 (diff)
downloadrust-1ec5650ad3a95d6ebdcaa21b87fb2d0f5423f0ba.tar.gz
rust-1ec5650ad3a95d6ebdcaa21b87fb2d0f5423f0ba.zip
libcoretest: fix unit tests
Diffstat (limited to 'src/libcoretest')
-rw-r--r--src/libcoretest/num/int_macros.rs10
-rw-r--r--src/libcoretest/num/mod.rs22
-rw-r--r--src/libcoretest/num/uint_macros.rs10
3 files changed, 22 insertions, 20 deletions
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs
index e25f10bd0da..87e2fe75299 100644
--- a/src/libcoretest/num/int_macros.rs
+++ b/src/libcoretest/num/int_macros.rs
@@ -64,11 +64,11 @@ mod tests {
 
     #[test]
     fn test_bitwise_operators() {
-        assert!(0b1110 as $T == (0b1100 as $T).bitor(&(0b1010 as $T)));
-        assert!(0b1000 as $T == (0b1100 as $T).bitand(&(0b1010 as $T)));
-        assert!(0b0110 as $T == (0b1100 as $T).bitxor(&(0b1010 as $T)));
-        assert!(0b1110 as $T == (0b0111 as $T).shl(&1));
-        assert!(0b0111 as $T == (0b1110 as $T).shr(&1));
+        assert!(0b1110 as $T == (0b1100 as $T).bitor(0b1010 as $T));
+        assert!(0b1000 as $T == (0b1100 as $T).bitand(0b1010 as $T));
+        assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T));
+        assert!(0b1110 as $T == (0b0111 as $T).shl(1));
+        assert!(0b0111 as $T == (0b1110 as $T).shr(1));
         assert!(-(0b11 as $T) - (1 as $T) == (0b11 as $T).not());
     }
 
diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs
index 6ee3633d36c..b7f8b81f996 100644
--- a/src/libcoretest/num/mod.rs
+++ b/src/libcoretest/num/mod.rs
@@ -12,6 +12,7 @@ use core::cmp::PartialEq;
 use core::fmt::Show;
 use core::num::{NumCast, cast};
 use core::ops::{Add, Sub, Mul, Div, Rem};
+use core::kinds::Copy;
 
 mod int_macros;
 mod i8;
@@ -32,18 +33,19 @@ pub fn test_num<T>(ten: T, two: T) where
      + Add<T, T> + Sub<T, T>
      + Mul<T, T> + Div<T, T>
      + Rem<T, T> + Show
+     + Copy
 {
-    assert_eq!(ten.add(&two),  cast(12i).unwrap());
-    assert_eq!(ten.sub(&two),  cast(8i).unwrap());
-    assert_eq!(ten.mul(&two),  cast(20i).unwrap());
-    assert_eq!(ten.div(&two),  cast(5i).unwrap());
-    assert_eq!(ten.rem(&two),  cast(0i).unwrap());
+    assert_eq!(ten.add(two),  cast(12i).unwrap());
+    assert_eq!(ten.sub(two),  cast(8i).unwrap());
+    assert_eq!(ten.mul(two),  cast(20i).unwrap());
+    assert_eq!(ten.div(two),  cast(5i).unwrap());
+    assert_eq!(ten.rem(two),  cast(0i).unwrap());
 
-    assert_eq!(ten.add(&two),  ten + two);
-    assert_eq!(ten.sub(&two),  ten - two);
-    assert_eq!(ten.mul(&two),  ten * two);
-    assert_eq!(ten.div(&two),  ten / two);
-    assert_eq!(ten.rem(&two),  ten % two);
+    assert_eq!(ten.add(two),  ten + two);
+    assert_eq!(ten.sub(two),  ten - two);
+    assert_eq!(ten.mul(two),  ten * two);
+    assert_eq!(ten.div(two),  ten / two);
+    assert_eq!(ten.rem(two),  ten % two);
 }
 
 #[cfg(test)]
diff --git a/src/libcoretest/num/uint_macros.rs b/src/libcoretest/num/uint_macros.rs
index 01a88119b64..5657a43de19 100644
--- a/src/libcoretest/num/uint_macros.rs
+++ b/src/libcoretest/num/uint_macros.rs
@@ -31,11 +31,11 @@ mod tests {
 
     #[test]
     fn test_bitwise_operators() {
-        assert!(0b1110 as $T == (0b1100 as $T).bitor(&(0b1010 as $T)));
-        assert!(0b1000 as $T == (0b1100 as $T).bitand(&(0b1010 as $T)));
-        assert!(0b0110 as $T == (0b1100 as $T).bitxor(&(0b1010 as $T)));
-        assert!(0b1110 as $T == (0b0111 as $T).shl(&1u));
-        assert!(0b0111 as $T == (0b1110 as $T).shr(&1u));
+        assert!(0b1110 as $T == (0b1100 as $T).bitor(0b1010 as $T));
+        assert!(0b1000 as $T == (0b1100 as $T).bitand(0b1010 as $T));
+        assert!(0b0110 as $T == (0b1100 as $T).bitxor(0b1010 as $T));
+        assert!(0b1110 as $T == (0b0111 as $T).shl(1u));
+        assert!(0b0111 as $T == (0b1110 as $T).shr(1u));
         assert!(MAX - (0b1011 as $T) == (0b1011 as $T).not());
     }