std::hashmap: Add test_iterate for HashSet

This commit is contained in:
blake2-ppc 2013-06-21 17:05:16 +02:00 committed by Daniel Micay
parent 080d498af2
commit 3af1d20bea

View File

@ -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();