mirror of
https://github.com/logos-blockchain/logos-blockchain-simulations.git
synced 2026-01-07 23:53:10 +00:00
Fix tests
This commit is contained in:
parent
67ef2dc2d2
commit
221cbd254a
@ -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(),
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user