From b18c75f20f937229c9b12bf3f07901090bd35317 Mon Sep 17 00:00:00 2001 From: tv Date: Fri, 6 Nov 2026 16:34:47 +0100 Subject: topology trait --- src/swarm/topology/tests.rs | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src/swarm/topology/tests.rs') diff --git a/src/swarm/topology/tests.rs b/src/swarm/topology/tests.rs index ede3b6b..8ee83c2 100644 --- a/src/swarm/topology/tests.rs +++ b/src/swarm/topology/tests.rs @@ -102,7 +102,14 @@ fn random_swarms() { if let Some(local) = live.iter().nth(rng.below(live.len())) { let others: Vec = all.iter().filter(|m| *m != local).cloned().collect(); assert_eq!( - neighbours(&others, local, k, &is_unreachable, &is_stable), + neighbours( + &RingAndPairs, + &others, + local, + k, + &is_unreachable, + &is_stable + ), g[local] ); } @@ -114,7 +121,7 @@ fn small_swarms_are_a_full_mesh() { let ms = members(13); for m in &ms { assert_eq!( - neighbours(&ms, m, 12, &all_reachable, &none_stable).len(), + neighbours(&RingAndPairs, &ms, m, 12, &all_reachable, &none_stable).len(), 12 ); } @@ -254,7 +261,15 @@ fn members_on_two_transports_bridge_the_others() { let no_stable = |_: &str| false; let mut graph: BTreeMap> = BTreeMap::new(); for (m, own) in &transports { - for n in neighbours_across(&transports, m, own, k, &all_reachable, &no_stable) { + for n in neighbours_across( + &RingAndPairs, + &transports, + m, + own, + k, + &all_reachable, + &no_stable, + ) { assert!( !transports[&n].is_disjoint(own), "{m} and {n} share no transport" @@ -274,8 +289,16 @@ fn members_on_two_transports_bridge_the_others() { ms.iter().map(|m| (m.clone(), on(&[""]))).collect(); for m in &ms[..5] { assert_eq!( - neighbours_across(&one, m, &on(&[""]), k, &all_reachable, &no_stable), - neighbours(&ms, m, k, &all_reachable, &no_stable) + neighbours_across( + &RingAndPairs, + &one, + m, + &on(&[""]), + k, + &all_reachable, + &no_stable + ), + neighbours(&RingAndPairs, &ms, m, k, &all_reachable, &no_stable) ); } } -- cgit v1.3.1