Check the cache against the reference built in the test.
(providers: &Providers, cache: &SubnetProviderCache)
| 291 | |
| 292 | /// Check the cache against the reference built in the test. |
| 293 | fn check_providers(providers: &Providers, cache: &SubnetProviderCache) -> Result<(), String> { |
| 294 | for (subnet_id, exp_peer_ids) in providers { |
| 295 | let peer_ids = cache.providers_of_subnet(subnet_id); |
| 296 | if peer_ids.len() != exp_peer_ids.len() { |
| 297 | return Err(format!( |
| 298 | "expected {} peers, got {} in subnet {:?}", |
| 299 | exp_peer_ids.len(), |
| 300 | peer_ids.len(), |
| 301 | subnet_id |
| 302 | )); |
| 303 | } |
| 304 | for peer_id in peer_ids { |
| 305 | if !exp_peer_ids.contains(&peer_id) { |
| 306 | return Err("wrong peer ID".into()); |
| 307 | } |
| 308 | } |
| 309 | } |
| 310 | Ok(()) |
| 311 | } |
| 312 | |
| 313 | #[quickcheck] |
| 314 | fn prop_subnets_pruned(records: TestRecords, max_subnets: usize) -> bool { |
no test coverage detected