[roads] rustfmt the QA tests and the fuzz targets (no change in behaviour)

This commit is contained in:
2026-11-25 08:16:24 +01:00
parent d5917e7aab
commit 7087b06e24
4 changed files with 114 additions and 35 deletions
+36 -18
View File
@@ -318,19 +318,24 @@ fn check_isomorphic(seed: u64) -> Result<(), TestCaseError> {
prop_assert_eq!(a, b, "the plan of {} depends on how ids are spelt", p0.name);
}
let problems = |c: &roads::Compiled, back: bool| -> BTreeSet<(String, Option<String>, String, String)> {
c.problems
.iter()
.map(|p| {
(
if back { ren.path_back(&p.path) } else { p.path.clone() },
p.field.clone(),
p.code.to_string(),
format!("{:?}", p.severity),
)
})
.collect()
};
let problems =
|c: &roads::Compiled, back: bool| -> BTreeSet<(String, Option<String>, String, String)> {
c.problems
.iter()
.map(|p| {
(
if back {
ren.path_back(&p.path)
} else {
p.path.clone()
},
p.field.clone(),
p.code.to_string(),
format!("{:?}", p.severity),
)
})
.collect()
};
prop_assert_eq!(problems(&c0, false), problems(&c1, true));
let (d0, d1) = (s0.devices.as_ref().unwrap(), s1.devices.as_ref().unwrap());
@@ -342,8 +347,10 @@ fn check_isomorphic(seed: u64) -> Result<(), TestCaseError> {
(Place::Device(b.clone()), Place::Device(b1.clone())),
(Place::Exit(b.clone()), Place::Exit(b1)),
] {
let w0: BTreeSet<String> =
roads::explain(&c0, d0, a, &p0).iter().map(|r| r.to_string()).collect();
let w0: BTreeSet<String> = roads::explain(&c0, d0, a, &p0)
.iter()
.map(|r| r.to_string())
.collect();
let w1: BTreeSet<String> = roads::explain(&c1, d1, &a1, &p1)
.iter()
.map(|r| ren.to_old[r.as_str()].clone())
@@ -363,11 +370,19 @@ fn the_extra_roads_reach_the_order_sensitive_paths() {
assert!(codes.contains("exit.conflict"), "{codes:?}");
let mark = &c.plans[&key(1)];
assert!(mark.exit.is_none(), "two exits: neither");
assert_eq!(mark.kill_switch.as_ref().unwrap().through, None, "two kill switches: no exit");
assert_eq!(
mark.kill_switch.as_ref().unwrap().through,
None,
"two kill switches: no exit"
);
let jana_phone = &c.plans[&key(3)];
let server = jana_phone.peers.iter().find(|p| p.key == key(2)).unwrap();
assert_eq!(server.via, None, "two different path hints: none");
assert!(c.errors().next().is_none(), "{:?}", c.errors().collect::<Vec<_>>());
assert!(
c.errors().next().is_none(),
"{:?}",
c.errors().collect::<Vec<_>>()
);
}
#[test]
@@ -378,7 +393,10 @@ fn the_identity_renaming_changes_nothing() {
to_new: BTreeMap::new(),
to_old: BTreeMap::new(),
};
assert_eq!(common::plans_bytes(&compile(&store_of(&ren.apply(&parts)), now())), before);
assert_eq!(
common::plans_bytes(&compile(&store_of(&ren.apply(&parts)), now())),
before
);
}
proptest! {