v0.16.3
This commit is contained in:
1 parent
8059e16d12
commit
05185a94f7
1 file changed
+87
-13
+87
-13
@@ -253,15 +253,39 @@ mod tests {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
assert!(flow_zone_action_already_satisfied(
|
assert!(flow_zone_action_already_satisfied(
|
||||||
&zone, false, 0, 0, Some("custom"), &on, None, None
|
&zone,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("custom"),
|
||||||
|
&on,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None
|
||||||
));
|
));
|
||||||
assert!(!flow_zone_action_already_satisfied(
|
assert!(!flow_zone_action_already_satisfied(
|
||||||
&zone, false, 0, 0, Some("custom"), &on, Some(1.1), Some(5.0)
|
&zone,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("custom"),
|
||||||
|
&on,
|
||||||
|
Some(1.1),
|
||||||
|
Some(5.0),
|
||||||
|
None
|
||||||
));
|
));
|
||||||
zone.heat_anticipation_c = 1.1;
|
zone.heat_anticipation_c = 1.1;
|
||||||
zone.standby_offset_c = 5.0;
|
zone.standby_offset_c = 5.0;
|
||||||
assert!(flow_zone_action_already_satisfied(
|
assert!(flow_zone_action_already_satisfied(
|
||||||
&zone, false, 0, 0, Some("custom"), &on, Some(1.1), Some(5.0)
|
&zone,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("custom"),
|
||||||
|
&on,
|
||||||
|
Some(1.1),
|
||||||
|
Some(5.0),
|
||||||
|
None
|
||||||
));
|
));
|
||||||
|
|
||||||
zone.manual_preset = None;
|
zone.manual_preset = None;
|
||||||
@@ -276,10 +300,26 @@ mod tests {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
assert!(flow_zone_action_already_satisfied(
|
assert!(flow_zone_action_already_satisfied(
|
||||||
&zone, false, 0, 0, Some("auto"), &off, None, None
|
&zone,
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("auto"),
|
||||||
|
&off,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None
|
||||||
));
|
));
|
||||||
assert!(!flow_zone_action_already_satisfied(
|
assert!(!flow_zone_action_already_satisfied(
|
||||||
&zone, true, 0, 0, Some("auto"), &off, None, None
|
&zone,
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("auto"),
|
||||||
|
&off,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -298,10 +338,26 @@ mod tests {
|
|||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
assert!(!flow_zone_action_already_satisfied(
|
assert!(!flow_zone_action_already_satisfied(
|
||||||
&zone, true, 0, 0, Some("custom"), &action, None, None
|
&zone,
|
||||||
|
true,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
Some("custom"),
|
||||||
|
&action,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None
|
||||||
));
|
));
|
||||||
assert!(flow_zone_action_already_satisfied(
|
assert!(flow_zone_action_already_satisfied(
|
||||||
&zone, true, 1, 0, Some("custom"), &action, None, None
|
&zone,
|
||||||
|
true,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
Some("custom"),
|
||||||
|
&action,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -429,13 +485,28 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn flow_change_gate_latches_until_action_ack_or_input_reset() {
|
fn flow_change_gate_latches_until_action_ack_or_input_reset() {
|
||||||
let mut state = crate::models::FlowRuntimeNodeState::default();
|
let mut state = crate::models::FlowRuntimeNodeState::default();
|
||||||
assert_eq!(flow_change_gate_update(&mut state, json!(false), false), (false, false));
|
assert_eq!(
|
||||||
assert_eq!(flow_change_gate_update(&mut state, json!(true), true), (true, true));
|
flow_change_gate_update(&mut state, json!(false), false),
|
||||||
assert_eq!(flow_change_gate_update(&mut state, json!(true), true), (false, true));
|
(false, false)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
flow_change_gate_update(&mut state, json!(true), true),
|
||||||
|
(true, true)
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
flow_change_gate_update(&mut state, json!(true), true),
|
||||||
|
(false, true)
|
||||||
|
);
|
||||||
state.pending = false;
|
state.pending = false;
|
||||||
assert_eq!(flow_change_gate_update(&mut state, json!(true), true), (false, false));
|
assert_eq!(
|
||||||
|
flow_change_gate_update(&mut state, json!(true), true),
|
||||||
|
(false, false)
|
||||||
|
);
|
||||||
state.pending = true;
|
state.pending = true;
|
||||||
assert_eq!(flow_change_gate_update(&mut state, json!(false), false), (true, false));
|
assert_eq!(
|
||||||
|
flow_change_gate_update(&mut state, json!(false), false),
|
||||||
|
(true, false)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
@@ -464,7 +535,10 @@ mod tests {
|
|||||||
fn flow_rolling_statistics_require_a_full_window_and_prune_samples() {
|
fn flow_rolling_statistics_require_a_full_window_and_prune_samples() {
|
||||||
let mut state = crate::models::FlowRuntimeNodeState::default();
|
let mut state = crate::models::FlowRuntimeNodeState::default();
|
||||||
let start = Utc.with_ymd_and_hms(2026, 9, 2, 12, 0, 0).unwrap();
|
let start = Utc.with_ymd_and_hms(2026, 9, 2, 12, 0, 0).unwrap();
|
||||||
assert_eq!(flow_rolling_stat_update(&mut state, 10.0, 60, "mean", start), None);
|
assert_eq!(
|
||||||
|
flow_rolling_stat_update(&mut state, 10.0, 60, "mean", start),
|
||||||
|
None
|
||||||
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
flow_rolling_stat_update(
|
flow_rolling_stat_update(
|
||||||
&mut state,
|
&mut state,
|
||||||
|
|||||||
Reference in new issue
Block a user