separate mod for tests
This commit is contained in:
parent
b477ca17fe
commit
59c0551ff4
@ -209,32 +209,38 @@ pub struct BloomJournal {
|
|||||||
pub entries: Vec<(usize, u64)>,
|
pub entries: Vec<(usize, u64)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn bloom_test_set() {
|
#[cfg(test)]
|
||||||
let mut bloom = Bloom::new(10, 80);
|
mod tests {
|
||||||
let key = vec![115u8, 99];
|
use super::Bloom;
|
||||||
assert!(!bloom.check(&key));
|
|
||||||
bloom.set(&key);
|
#[test]
|
||||||
assert!(bloom.check(&key));
|
fn bloom_test_set() {
|
||||||
}
|
let mut bloom = Bloom::new(10, 80);
|
||||||
|
let key = vec![115u8, 99];
|
||||||
#[test]
|
assert!(!bloom.check(&key));
|
||||||
fn bloom_journalling() {
|
bloom.set(&key);
|
||||||
let initial = vec![0u64; 8];
|
assert!(bloom.check(&key));
|
||||||
let mut bloom = Bloom::from_parts(&initial, 3);
|
}
|
||||||
bloom.set(&vec![5u8, 4]);
|
|
||||||
let drain = bloom.drain_journal();
|
#[test]
|
||||||
|
fn bloom_journalling() {
|
||||||
assert_eq!(2, drain.entries.len())
|
let initial = vec![0u64; 8];
|
||||||
}
|
let mut bloom = Bloom::from_parts(&initial, 3);
|
||||||
|
bloom.set(&vec![5u8, 4]);
|
||||||
#[test]
|
let drain = bloom.drain_journal();
|
||||||
fn bloom_howfull() {
|
|
||||||
let initial = vec![0u64; 8];
|
assert_eq!(2, drain.entries.len())
|
||||||
let mut bloom = Bloom::from_parts(&initial, 3);
|
}
|
||||||
bloom.set(&vec![5u8, 4]);
|
|
||||||
|
#[test]
|
||||||
let full = bloom.how_full();
|
fn bloom_howfull() {
|
||||||
// 2/8/64 = 0.00390625
|
let initial = vec![0u64; 8];
|
||||||
assert!(full >= 0.0039f64 && full <= 0.004f64);
|
let mut bloom = Bloom::from_parts(&initial, 3);
|
||||||
|
bloom.set(&vec![5u8, 4]);
|
||||||
|
|
||||||
|
let full = bloom.how_full();
|
||||||
|
// 2/8/64 = 0.00390625
|
||||||
|
assert!(full >= 0.0039f64 && full <= 0.004f64);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user