blob: 8c6c024a9d87269f1f20db23429521bee03ae574 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/// Macro for testing round-trip conversion for ClientToServerMsg variants
macro_rules! test_client_roundtrip {
($msg:expr) => {{
let original: crate::ipc::ClientToServerMsg = $msg;
let proto: crate::client_server_contract::client_server_contract::ClientToServerMsg =
original.clone().into();
let roundtrip: crate::ipc::ClientToServerMsg = proto
.try_into()
.expect("Failed to convert back from protobuf");
assert_eq!(original, roundtrip);
}};
}
/// Macro for testing round-trip conversion for ServerToClientMsg variants
macro_rules! test_server_roundtrip {
($msg:expr) => {{
let original: crate::ipc::ServerToClientMsg = $msg;
let proto: crate::client_server_contract::client_server_contract::ServerToClientMsg =
original.clone().into();
let roundtrip: crate::ipc::ServerToClientMsg = proto
.try_into()
.expect("Failed to convert back from protobuf");
assert_eq!(original, roundtrip);
}};
}
pub(crate) use {test_client_roundtrip, test_server_roundtrip};
|