mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 19:51:47 +00:00
Add tests and benches for epoch processing
This commit is contained in:
@@ -9,6 +9,8 @@ use types::{
|
||||
Crosslink, Epoch, Hash256, InclusionError, PendingAttestation, RelativeEpoch,
|
||||
};
|
||||
|
||||
mod tests;
|
||||
|
||||
macro_rules! safe_add_assign {
|
||||
($a: expr, $b: expr) => {
|
||||
$a = $a.saturating_add($b);
|
||||
@@ -725,11 +727,3 @@ impl From<BeaconStateError> for WinningRootError {
|
||||
WinningRootError::BeaconStateError(e)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
#[test]
|
||||
fn it_works() {
|
||||
assert_eq!(2 + 2, 4);
|
||||
}
|
||||
}
|
||||
|
||||
21
eth2/state_processing/src/epoch_processable/tests.rs
Normal file
21
eth2/state_processing/src/epoch_processable/tests.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
#![cfg(test)]
|
||||
use crate::EpochProcessable;
|
||||
use env_logger::{Builder, Env};
|
||||
use types::beacon_state::BeaconStateBuilder;
|
||||
use types::*;
|
||||
|
||||
#[test]
|
||||
fn runs_without_error() {
|
||||
Builder::from_env(Env::default().default_filter_or("error")).init();
|
||||
|
||||
let mut builder = BeaconStateBuilder::with_random_validators(8);
|
||||
builder.spec = ChainSpec::few_validators();
|
||||
|
||||
builder.genesis().unwrap();
|
||||
builder.teleport_to_end_of_epoch(builder.spec.genesis_epoch + 4);
|
||||
|
||||
let mut state = builder.build().unwrap();
|
||||
|
||||
let spec = &builder.spec;
|
||||
state.per_epoch_processing(spec).unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user