Fix tests

This commit is contained in:
Daniel Sanchez Quiros 2024-11-07 12:03:07 +07:00
parent 67ef2dc2d2
commit 221cbd254a

View File

@ -101,9 +101,10 @@ where
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use std::collections::HashSet;
use std::{collections::HashMap, time::Duration}; use std::{collections::HashMap, time::Duration};
use consensus_engine::View; type View = usize;
use crate::{ use crate::{
network::{ network::{
@ -123,7 +124,7 @@ mod tests {
use super::*; use super::*;
#[derive(Debug, Clone, Serialize)] #[derive(Debug, Clone, Serialize)]
struct SettingsRecord { struct SettingsRecord {
states: HashMap<NodeId, View>, states: HashSet<NodeId>,
} }
impl<S, T: Serialize> TryFrom<&SimulationState<S, T>> for SettingsRecord { impl<S, T: Serialize> TryFrom<&SimulationState<S, T>> for SettingsRecord {
@ -131,12 +132,7 @@ mod tests {
fn try_from(value: &SimulationState<S, T>) -> Result<Self, Self::Error> { fn try_from(value: &SimulationState<S, T>) -> Result<Self, Self::Error> {
Ok(Self { Ok(Self {
states: value states: value.nodes.read().iter().map(|node| node.id()).collect(),
.nodes
.read()
.iter()
.map(|node| (node.id(), node.current_view()))
.collect(),
}) })
} }
} }