Skip to content

Commit 95df1f0

Browse files
committed
Add a test for (de)serializing an empty GraphUpdate
1 parent 3f8620e commit 95df1f0

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/src/graph/update.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,21 @@ mod tests {
380380
assert_eq!(example_updates, deseralized_events);
381381
}
382382

383+
#[test]
384+
fn serialize_deserialize_bincode_empty() {
385+
let example_updates: Vec<UpdateEvent> = Vec::new();
386+
387+
let mut updates = GraphUpdate::new();
388+
for e in example_updates.iter() {
389+
updates.add_event(e.clone()).unwrap();
390+
}
391+
392+
let seralized_bytes: Vec<u8> = bincode::serialize(&updates).unwrap();
393+
let deseralized_update: GraphUpdate = bincode::deserialize(&seralized_bytes).unwrap();
394+
395+
assert_eq!(0, deseralized_update.len().unwrap());
396+
}
397+
383398
#[test]
384399
fn serialize_json() {
385400
let example_updates = vec![

0 commit comments

Comments
 (0)