mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 15:54:15 +00:00
std::hashmap: Add test_iterate for HashSet
This commit is contained in:
parent
080d498af2
commit
3af1d20bea
@ -952,6 +952,7 @@ mod test_set {
|
||||
use super::*;
|
||||
use container::{Container, Map, Set};
|
||||
use vec;
|
||||
use uint;
|
||||
|
||||
#[test]
|
||||
fn test_disjoint() {
|
||||
@ -1004,6 +1005,19 @@ mod test_set {
|
||||
assert!(b.is_superset(&a));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_iterate() {
|
||||
let mut a = HashSet::new();
|
||||
for uint::range(0, 32) |i| {
|
||||
assert!(a.insert(i));
|
||||
}
|
||||
let mut observed = 0;
|
||||
for a.iter().advance |k| {
|
||||
observed |= (1 << *k);
|
||||
}
|
||||
assert_eq!(observed, 0xFFFF_FFFF);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_intersection() {
|
||||
let mut a = HashSet::new();
|
||||
|
Loading…
Reference in New Issue
Block a user