Update tests

This commit is contained in:
Pierre HUBERT 2024-08-27 18:41:01 +02:00
parent 50e61707cc
commit f46a7dbc94

View File

@ -321,8 +321,12 @@ mod tests {
..Default::default() ..Default::default()
}; };
dep_cycle_1.depends_on = vec![dep_cycle_3.id]; dep_cycle_1.depends_on = vec![dep_cycle_3.id];
assert!(dep_cycle_1
.error(&[dep_cycle_2.clone(), dep_cycle_3.clone()])
.is_some());
assert!(dep_cycle_1.error(&[dep_cycle_2, dep_cycle_3]).is_some()); dep_cycle_1.depends_on = vec![];
assert!(dep_cycle_1.error(&[dep_cycle_2, dep_cycle_3]).is_none());
// Impossible conflict // Impossible conflict
let other_dep = DeviceRelay { let other_dep = DeviceRelay {
@ -330,7 +334,7 @@ mod tests {
name: "other_dep".to_string(), name: "other_dep".to_string(),
..Default::default() ..Default::default()
}; };
let second_dep = DeviceRelay { let mut second_dep = DeviceRelay {
id: DeviceRelayID::default(), id: DeviceRelayID::default(),
name: "second_dep".to_string(), name: "second_dep".to_string(),
conflicts_with: vec![other_dep.id], conflicts_with: vec![other_dep.id],
@ -347,7 +351,16 @@ mod tests {
.error(&[other_dep.clone(), second_dep.clone()]) .error(&[other_dep.clone(), second_dep.clone()])
.is_some()); .is_some());
assert!(target_relay assert!(target_relay
.error(&[other_dep, second_dep, target_relay.clone()]) .error(&[other_dep.clone(), second_dep.clone(), target_relay.clone()])
.is_some()); .is_some());
second_dep.conflicts_with = vec![];
assert!(target_relay
.error(&[other_dep.clone(), second_dep.clone()])
.is_none());
assert!(target_relay
.error(&[other_dep.clone(), second_dep.clone(), target_relay.clone()])
.is_none());
} }
} }