parent
7024c73e9b
commit
114e2989fa
|
@ -226,7 +226,7 @@ mod tests {
|
||||||
assert_eq!(poh.remaining_hashes, 2);
|
assert_eq!(poh.remaining_hashes, 2);
|
||||||
assert!(poh.tick().is_none());
|
assert!(poh.tick().is_none());
|
||||||
assert_eq!(poh.remaining_hashes, 1);
|
assert_eq!(poh.remaining_hashes, 1);
|
||||||
assert!(poh.tick().is_some());
|
assert_matches!(poh.tick(), Some(PohEntry { num_hashes: 2, .. }));
|
||||||
assert_eq!(poh.remaining_hashes, 2); // Ready for the next tick
|
assert_eq!(poh.remaining_hashes, 2); // Ready for the next tick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,7 +255,11 @@ mod tests {
|
||||||
assert!(poh.hash(9));
|
assert!(poh.hash(9));
|
||||||
assert_eq!(poh.remaining_hashes, 1);
|
assert_eq!(poh.remaining_hashes, 1);
|
||||||
assert!(poh.record(Hash::default()).is_none()); // <-- record() rejected to avoid exceeding hashes_per_tick
|
assert!(poh.record(Hash::default()).is_none()); // <-- record() rejected to avoid exceeding hashes_per_tick
|
||||||
poh.tick();
|
assert_matches!(poh.tick(), Some(PohEntry { num_hashes: 10, .. }));
|
||||||
assert!(poh.record(Hash::default()).is_some()); // <-- record() ok
|
assert_matches!(
|
||||||
|
poh.record(Hash::default()),
|
||||||
|
Some(PohEntry { num_hashes: 1, .. }) // <-- record() ok
|
||||||
|
);
|
||||||
|
assert_eq!(poh.remaining_hashes, 9);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue