fn new(rng: &mut TestRng) -> Self {
        const DISTINCT_EVENTS_COUNT: u32 = 7;

        let _ = logging::init();
        let storage_dir = tempfile::tempdir().unwrap();
        fs::create_dir_all(&storage_dir).unwrap();
        let protocol_version = ProtocolVersion::from_parts(1, 2, 3);

        let mut deploys = HashMap::new();
        let events = (0..EVENT_COUNT)
            .map(|i| match i % DISTINCT_EVENTS_COUNT {
                0 => SseData::random_block_added(rng),
                1 => {
                    let (event, deploy) = SseData::random_deploy_accepted(rng);
                    assert!(deploys.insert(*deploy.id(), deploy).is_none());
                    event
                }
                2 => SseData::random_deploy_processed(rng),
                3 => SseData::random_deploy_expired(rng),
                4 => SseData::random_fault(rng),
                5 => SseData::random_step(rng),
                6 => SseData::random_finality_signature(rng),
                _ => unreachable!(),
            })
            .collect();

        let deploy_getter = DeployGetter::with_deploys(deploys);

        TestFixture {
            storage_dir,
            protocol_version,
            events,
            deploy_getter,
            first_event_id: 0,
            server_join_handle: None,
            server_stopper: ServerStopper::new(),
        }
    }
/// Constructs a new `TestFixture` including `EVENT_COUNT` random events ready to be served.
Constructs a new `TestFixture` including `EVENT_COUNT` random events ready to be served.
Constructs a new ` TestFixture ` including ` EVENT_COUNT ` random events ready to be served .
fn new(rng: &mut TestRng) -> Self {
        const DISTINCT_EVENTS_COUNT: u32 = 7;
        let _ = logging::init();
        let storage_dir = tempfile::tempdir().unwrap();
        fs::create_dir_all(&storage_dir).unwrap();
        let protocol_version = ProtocolVersion::from_parts(1, 2, 3);
        let mut deploys = HashMap::new();
        let events = (0..EVENT_COUNT)
            .map(|i| match i % DISTINCT_EVENTS_COUNT {
                0 => SseData::random_block_added(rng),
                1 => {
                    let (event, deploy) = SseData::random_deploy_accepted(rng);
                    assert!(deploys.insert(*deploy.id(), deploy).is_none());
                    event
                }
                2 => SseData::random_deploy_processed(rng),
                3 => SseData::random_deploy_expired(rng),
                4 => SseData::random_fault(rng),
                5 => SseData::random_step(rng),
                6 => SseData::random_finality_signature(rng),
                _ => unreachable!(),
            })
            .collect();
        let deploy_getter = DeployGetter::with_deploys(deploys);
        TestFixture {
            storage_dir,
            protocol_version,
            events,
            deploy_getter,
            first_event_id: 0,
            server_join_handle: None,
            server_stopper: ServerStopper::new(),
        }
    }
fn new ( rng : & mut TestRng ) -> Self { const DISTINCT_EVENTS_COUNT : u32 = 7 ; let _ = logging :: init ( ) ; let storage_dir = tempfile :: tempdir ( ) . unwrap ( ) ; fs :: create_dir_all ( & storage_dir ) . unwrap ( ) ; let protocol_version = ProtocolVersion :: from_parts ( 1 , 2 , 3 ) ; let mut deploys = HashMap :: new ( ) ; let events = ( 0 .. EVENT_COUNT ) . map ( | i | match i % DISTINCT_EVENTS_COUNT { 0 => SseData :: random_block_added ( rng ) , 1 => { let ( event , deploy ) = SseData :: random_deploy_accepted ( rng ) ; assert ! ( deploys insert ( deploy id ( ) deploy ) is_none ( ) ) ; event } 2 => SseData :: random_deploy_processed ( rng ) , 3 => SseData :: random_deploy_expired ( rng ) , 4 => SseData :: random_fault ( rng ) , 5 => SseData :: random_step ( rng ) , 6 => SseData :: random_finality_signature ( rng ) , _ => unreachable ! ( ) , } ) . collect ( ) ; let deploy_getter = DeployGetter :: with_deploys ( deploys ) ; TestFixture { storage_dir , protocol_version , events , deploy_getter , first_event_id : 0 , server_join_handle : None , server_stopper : ServerStopper :: new ( ) , } }
Constructs a new `TestFixture` including `EVENT_COUNT` random events ready to be served.
Constructs a new ` TestFixture ` including ` EVENT_COUNT ` random events ready to be served .
rng
&mut TestRng
rng
&mut TestRng