Skip to content

Commit

Permalink
mshv-bindings: test case for state components serialize/deserialize
Browse files Browse the repository at this point in the history
Signed-off-by: Muminul Islam <[email protected]>
  • Loading branch information
russell-islam committed Apr 12, 2024
1 parent 810de05 commit b9b0972
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions mshv-bindings/src/serializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,21 @@ mod tests {
.zip(d_xsave.buffer.iter())
.all(|(a, b)| a == b));
}

#[test]
fn test_vp_state_components_serialization_deserialization() {
let mut states = AllVpStateComponents {
..Default::default()
};
for i in 0..VP_STATE_COMPONENTS_BUFFER_SIZE {
states.buffer[i] = 0xC8;
}
let serialized = serde_json::to_string(&states).expect("err ser");
let d_states: AllVpStateComponents = serde_json::from_str(&serialized).expect("err unser");
assert!(states
.buffer
.iter()
.zip(d_states.buffer.iter())
.all(|(a, b)| a == b));
}
}

0 comments on commit b9b0972

Please sign in to comment.