diff options
| author | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-02 03:53:41 +0530 |
|---|---|---|
| committer | Manish Goregaokar <manishsmail@gmail.com> | 2015-03-02 03:53:41 +0530 |
| commit | fb19cd7fb775fee1afb315525dcdc82472796337 (patch) | |
| tree | 4e80f876be4415a5aaf6b0e8c1d4ace23066444a /src/libcoretest | |
| parent | 157614249594f187f421cd97f928e64c5ab5c1fa (diff) | |
| parent | df126589b91c7b60e2426b46c5a8b14d7d04f667 (diff) | |
| download | rust-fb19cd7fb775fee1afb315525dcdc82472796337.tar.gz rust-fb19cd7fb775fee1afb315525dcdc82472796337.zip | |
Rollup merge of #22504 - GuillaumeGomez:audit-integer-libcore, r=Manishearth
Part of #22240.
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/iter.rs | 14 | ||||
| -rw-r--r-- | src/libcoretest/num/int.rs | 11 | ||||
| -rw-r--r-- | src/libcoretest/num/int_macros.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/num/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcoretest/num/uint.rs | 11 |
5 files changed, 9 insertions, 33 deletions
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs index 8a27400389f..abf88583c03 100644 --- a/src/libcoretest/iter.rs +++ b/src/libcoretest/iter.rs @@ -12,7 +12,7 @@ use core::iter::*; use core::iter::order::*; use core::iter::MinMaxResult::*; use core::num::SignedInt; -use core::uint; +use core::usize; use core::cmp; use test::Bencher; @@ -292,7 +292,7 @@ fn test_unfoldr() { fn test_cycle() { let cycle_len = 3; let it = count(0, 1).take(cycle_len).cycle(); - assert_eq!(it.size_hint(), (uint::MAX, None)); + assert_eq!(it.size_hint(), (usize::MAX, None)); for (i, x) in it.take(100).enumerate() { assert_eq!(i % cycle_len, x); } @@ -365,19 +365,19 @@ fn test_iterator_size_hint() { let v2 = &[10, 11, 12]; let vi = v.iter(); - assert_eq!(c.size_hint(), (uint::MAX, None)); + assert_eq!(c.size_hint(), (usize::MAX, None)); assert_eq!(vi.clone().size_hint(), (10, Some(10))); assert_eq!(c.clone().take(5).size_hint(), (5, Some(5))); assert_eq!(c.clone().skip(5).size_hint().1, None); assert_eq!(c.clone().take_while(|_| false).size_hint(), (0, None)); assert_eq!(c.clone().skip_while(|_| false).size_hint(), (0, None)); - assert_eq!(c.clone().enumerate().size_hint(), (uint::MAX, None)); - assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (uint::MAX, None)); + assert_eq!(c.clone().enumerate().size_hint(), (usize::MAX, None)); + assert_eq!(c.clone().chain(vi.clone().cloned()).size_hint(), (usize::MAX, None)); assert_eq!(c.clone().zip(vi.clone()).size_hint(), (10, Some(10))); assert_eq!(c.clone().scan(0, |_,_| Some(0)).size_hint(), (0, None)); assert_eq!(c.clone().filter(|_| false).size_hint(), (0, None)); - assert_eq!(c.clone().map(|_| 0).size_hint(), (uint::MAX, None)); + assert_eq!(c.clone().map(|_| 0).size_hint(), (usize::MAX, None)); assert_eq!(c.filter_map(|_| Some(0)).size_hint(), (0, None)); assert_eq!(vi.clone().take(5).size_hint(), (5, Some(5))); @@ -753,7 +753,7 @@ fn test_range() { assert_eq!((0..100).size_hint(), (100, Some(100))); // this test is only meaningful when sizeof uint < sizeof u64 - assert_eq!((uint::MAX - 1..uint::MAX).size_hint(), (1, Some(1))); + assert_eq!((usize::MAX - 1..usize::MAX).size_hint(), (1, Some(1))); assert_eq!((-10..-1).size_hint(), (9, Some(9))); assert_eq!((-1..-10).size_hint(), (0, Some(0))); } diff --git a/src/libcoretest/num/int.rs b/src/libcoretest/num/int.rs deleted file mode 100644 index be8dfd02ee1..00000000000 --- a/src/libcoretest/num/int.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -int_module!(int, int); diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index c33729876cc..d1bfb475b07 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -12,7 +12,7 @@ macro_rules! int_module { ($T:ty, $T_i:ident) => ( #[cfg(test)] mod tests { use core::$T_i::*; - use core::int; + use core::isize; use core::num::{FromStrRadix, Int, SignedInt}; use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr}; use num; @@ -153,7 +153,7 @@ mod tests { fn test_signed_checked_div() { assert!(10.checked_div(2) == Some(5)); assert!(5.checked_div(0) == None); - assert!(int::MIN.checked_div(-1) == None); + assert!(isize::MIN.checked_div(-1) == None); } #[test] diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 03f6e51a349..1cd1989c11d 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -21,7 +21,6 @@ mod i8; mod i16; mod i32; mod i64; -mod int; #[macro_use] mod uint_macros; @@ -30,7 +29,6 @@ mod u8; mod u16; mod u32; mod u64; -mod uint; /// Helper function for testing numeric operations pub fn test_num<T>(ten: T, two: T) where diff --git a/src/libcoretest/num/uint.rs b/src/libcoretest/num/uint.rs deleted file mode 100644 index 395e55cf255..00000000000 --- a/src/libcoretest/num/uint.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -uint_module!(uint, uint); |
