Skip to content

Commit

Permalink
test: added nop test for period_union
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed May 11, 2021
1 parent 294edaf commit c3b178f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions aw-transform/src/period_union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,21 @@ mod tests {
assert_eq!(e_result[0].timestamp, dt);
assert_eq!(e_result[0].duration, Duration::milliseconds(2000));
}

/// Make sure nothing gets done when nothing to union (gaps present)
#[test]
fn test_period_union_nop() {
let e1 = Event {
id: None,
timestamp: DateTime::from_str("2000-01-01T00:00:01Z").unwrap(),
duration: Duration::seconds(1),
data: json_map! {"test": json!(1)},
};

let mut e2 = e1.clone();
e2.timestamp = DateTime::from_str("2000-01-01T00:00:03Z").unwrap();

let e_result = period_union(&[e1], &[e2]);
assert_eq!(e_result.len(), 2);
}
}

0 comments on commit c3b178f

Please sign in to comment.