v0.15.9
This commit is contained in:
1 parent
044adef401
commit
ac2dd8b62a
21 files changed
+288
-97
No files matched your search
+17
-27
@@ -306,12 +306,15 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flow_change_gate_ignores_first_observation_and_detects_later_change() {
|
||||
fn flow_change_gate_latches_until_action_ack_or_input_reset() {
|
||||
let mut state = crate::models::FlowRuntimeNodeState::default();
|
||||
assert!(!flow_change_gate_update(&mut state, json!("off")));
|
||||
assert!(!flow_change_gate_update(&mut state, json!("off")));
|
||||
assert!(flow_change_gate_update(&mut state, json!("on")));
|
||||
assert!(!flow_change_gate_update(&mut state, json!("on")));
|
||||
assert_eq!(flow_change_gate_update(&mut state, json!(false), false), (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;
|
||||
assert_eq!(flow_change_gate_update(&mut state, json!(true), true), (false, false));
|
||||
state.pending = true;
|
||||
assert_eq!(flow_change_gate_update(&mut state, json!(false), false), (true, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -337,30 +340,27 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn flow_rolling_statistics_compute_mean_median_and_prune_window() {
|
||||
fn flow_rolling_statistics_require_a_full_window_and_prune_samples() {
|
||||
let mut state = crate::models::FlowRuntimeNodeState::default();
|
||||
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),
|
||||
Some(10.0)
|
||||
);
|
||||
assert_eq!(flow_rolling_stat_update(&mut state, 10.0, 60, "mean", start), None);
|
||||
assert_eq!(
|
||||
flow_rolling_stat_update(
|
||||
&mut state,
|
||||
20.0,
|
||||
60,
|
||||
"mean",
|
||||
start + chrono::Duration::seconds(10)
|
||||
start + chrono::Duration::seconds(30)
|
||||
),
|
||||
Some(15.0)
|
||||
None
|
||||
);
|
||||
assert_eq!(
|
||||
flow_rolling_stat_update(
|
||||
&mut state,
|
||||
30.0,
|
||||
60,
|
||||
"median",
|
||||
start + chrono::Duration::seconds(20)
|
||||
"mean",
|
||||
start + chrono::Duration::seconds(60)
|
||||
),
|
||||
Some(20.0)
|
||||
);
|
||||
@@ -370,21 +370,11 @@ mod tests {
|
||||
40.0,
|
||||
60,
|
||||
"median",
|
||||
start + chrono::Duration::seconds(30)
|
||||
start + chrono::Duration::seconds(90)
|
||||
),
|
||||
Some(25.0)
|
||||
Some(30.0)
|
||||
);
|
||||
assert_eq!(
|
||||
flow_rolling_stat_update(
|
||||
&mut state,
|
||||
100.0,
|
||||
60,
|
||||
"mean",
|
||||
start + chrono::Duration::seconds(100)
|
||||
),
|
||||
Some(100.0)
|
||||
);
|
||||
assert_eq!(state.samples.len(), 1);
|
||||
assert_eq!(state.samples.len(), 3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user