bigint: add a Hash test

This commit is contained in:
Josh Stone 2015-12-16 22:32:00 -08:00
parent 9b45e6dd9b
commit b84142fc28
1 changed files with 11 additions and 0 deletions

View File

@ -177,3 +177,14 @@ fn shr(b: &mut Bencher) {
}
})
}
#[bench]
fn hash(b: &mut Bencher) {
use std::collections::HashSet;
let mut rng = get_rng();
let v: Vec<BigInt> = (1000..2000).map(|bits| rng.gen_bigint(bits)).collect();
b.iter(|| {
let h: HashSet<&BigInt> = v.iter().collect();
assert_eq!(h.len(), v.len());
});
}