diff options
| author | bors <bors@rust-lang.org> | 2014-06-25 02:02:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-25 02:02:00 +0000 |
| commit | 91be86af0952aebb1f7c1811a6abcccd7bd1c26e (patch) | |
| tree | 45fd08bfce0007e8e32453b94fd3229d1a13fba3 /src/libnum | |
| parent | 05ca9f747d62c9385cc142daa3c24a32d32a3f16 (diff) | |
| parent | cdccecb24f5c467282b73413494343d3848b4e5a (diff) | |
| download | rust-91be86af0952aebb1f7c1811a6abcccd7bd1c26e.tar.gz rust-91be86af0952aebb1f7c1811a6abcccd7bd1c26e.zip | |
auto merge of #15163 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/libnum')
| -rw-r--r-- | src/libnum/bigint.rs | 10 | ||||
| -rw-r--r-- | src/libnum/lib.rs | 2 | ||||
| -rw-r--r-- | src/libnum/rational.rs | 18 |
3 files changed, 16 insertions, 14 deletions
diff --git a/src/libnum/bigint.rs b/src/libnum/bigint.rs index e9153f89e04..06e4792cdcc 100644 --- a/src/libnum/bigint.rs +++ b/src/libnum/bigint.rs @@ -2172,7 +2172,7 @@ mod biguint_tests { fn test_rand_range() { let mut rng = task_rng(); - for _ in range(0, 10) { + for _ in range(0u, 10) { assert_eq!(rng.gen_bigint_range(&FromPrimitive::from_uint(236).unwrap(), &FromPrimitive::from_uint(237).unwrap()), FromPrimitive::from_uint(236).unwrap()); @@ -2180,7 +2180,7 @@ mod biguint_tests { let l = FromPrimitive::from_uint(403469000 + 2352).unwrap(); let u = FromPrimitive::from_uint(403469000 + 3513).unwrap(); - for _ in range(0, 1000) { + for _ in range(0u, 1000) { let n: BigUint = rng.gen_biguint_below(&u); assert!(n < u); @@ -2761,7 +2761,7 @@ mod bigint_tests { fn test_rand_range() { let mut rng = task_rng(); - for _ in range(0, 10) { + for _ in range(0u, 10) { assert_eq!(rng.gen_bigint_range(&FromPrimitive::from_uint(236).unwrap(), &FromPrimitive::from_uint(237).unwrap()), FromPrimitive::from_uint(236).unwrap()); @@ -2769,7 +2769,7 @@ mod bigint_tests { fn check(l: BigInt, u: BigInt) { let mut rng = task_rng(); - for _ in range(0, 1000) { + for _ in range(0u, 1000) { let n: BigInt = rng.gen_bigint_range(&l, &u); assert!(n >= l); assert!(n < u); @@ -2858,7 +2858,7 @@ mod bench { let n = { let one : BigUint = One::one(); one << 1000 }; b.iter(|| { let mut m = n.clone(); - for _ in range(0, 10) { + for _ in range(0u, 10) { m = m >> 1; } }) diff --git a/src/libnum/lib.rs b/src/libnum/lib.rs index 6803b91143e..1e82da5ef8d 100644 --- a/src/libnum/lib.rs +++ b/src/libnum/lib.rs @@ -54,6 +54,8 @@ html_root_url = "http://doc.rust-lang.org/", html_playground_url = "http://play.rust-lang.org/")] +#![allow(deprecated)] // from_str_radix + extern crate rand; pub use bigint::{BigInt, BigUint}; diff --git a/src/libnum/rational.rs b/src/libnum/rational.rs index faf05365c04..971b6b1b51b 100644 --- a/src/libnum/rational.rs +++ b/src/libnum/rational.rs @@ -353,10 +353,10 @@ mod test { // check our constants are what Ratio::new etc. would make. assert_eq!(_0, Zero::zero()); assert_eq!(_1, One::one()); - assert_eq!(_2, Ratio::from_integer(2)); - assert_eq!(_1_2, Ratio::new(1,2)); - assert_eq!(_3_2, Ratio::new(3,2)); - assert_eq!(_neg1_2, Ratio::new(-1,2)); + assert_eq!(_2, Ratio::from_integer(2i)); + assert_eq!(_1_2, Ratio::new(1i,2i)); + assert_eq!(_3_2, Ratio::new(3i,2i)); + assert_eq!(_neg1_2, Ratio::new(-1i,2i)); } #[test] @@ -368,7 +368,7 @@ mod test { #[test] #[should_fail] fn test_new_zero() { - let _a = Ratio::new(1,0); + let _a = Ratio::new(1i,0); } @@ -466,8 +466,8 @@ mod test { } test(_1, _1_2, _1_2); - test(_1_2, _3_2, Ratio::new(3,4)); - test(_1_2, _neg1_2, Ratio::new(-1, 4)); + test(_1_2, _3_2, Ratio::new(3i,4i)); + test(_1_2, _neg1_2, Ratio::new(-1i, 4i)); } #[test] @@ -606,7 +606,7 @@ mod test { test16(_2, "2/1".to_string()); test16(_neg1_2, "-1/2".to_string()); test16(_neg1_2 / _2, "-1/4".to_string()); - test16(Ratio::new(13,15), "d/f".to_string()); + test16(Ratio::new(13i,15i), "d/f".to_string()); test16(_1_2*_1_2*_1_2*_1_2, "1/10".to_string()); } @@ -645,7 +645,7 @@ mod test { test(2f64.powf(100.), ("1267650600228229401496703205376", "1")); test(-2f64.powf(100.), ("-1267650600228229401496703205376", "1")); test(684729.48391f64, ("367611342500051", "536870912")); - test(-8573.5918555, ("-4713381968463931", "549755813888")); + test(-8573.5918555f64, ("-4713381968463931", "549755813888")); test(1.0 / 2f64.powf(100.), ("1", "1267650600228229401496703205376")); } |
