mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 02:42:38 +00:00
Move test defs into crate
This commit is contained in:
@@ -1,18 +1,6 @@
|
||||
use proto_array_fork_choice::ProtoArrayForkChoice;
|
||||
use crate::ProtoArrayForkChoice;
|
||||
use types::{Epoch, Hash256, Slot};
|
||||
|
||||
#[test]
|
||||
fn no_votes() {
|
||||
let test = get_no_votes_test_definition();
|
||||
test.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn votes() {
|
||||
let test = get_votes_test_definition();
|
||||
test.run();
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Operation {
|
||||
FindHead {
|
||||
@@ -57,7 +45,7 @@ pub struct ForkChoiceTestDefinition {
|
||||
}
|
||||
|
||||
impl ForkChoiceTestDefinition {
|
||||
fn run(self) {
|
||||
pub fn run(self) {
|
||||
let fork_choice = ProtoArrayForkChoice::new(
|
||||
self.finalized_block_slot,
|
||||
self.justified_epoch,
|
||||
@@ -184,7 +172,7 @@ fn check_bytes_round_trip(original: &ProtoArrayForkChoice) {
|
||||
);
|
||||
}
|
||||
|
||||
fn get_no_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
pub fn get_no_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
let balances = vec![0; 16];
|
||||
|
||||
let operations = vec![
|
||||
@@ -410,7 +398,7 @@ fn get_no_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
pub fn get_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
let mut balances = vec![1; 2];
|
||||
let mut ops = vec![];
|
||||
|
||||
@@ -1097,3 +1085,19 @@ fn get_votes_test_definition() -> ForkChoiceTestDefinition {
|
||||
operations: ops,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn no_votes() {
|
||||
let test = get_no_votes_test_definition();
|
||||
test.run();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn votes() {
|
||||
let test = get_votes_test_definition();
|
||||
test.run();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
pub mod fork_choice_test_definition;
|
||||
mod proto_array;
|
||||
mod ssz_container;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user