MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / msgpack_roundtrip

Function msgpack_roundtrip

nodedb/src/control/server/native/codec.rs:152–167  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150
151 #[test]
152 fn msgpack_roundtrip() {
153 let req = NativeRequest {
154 op: OpCode::Sql,
155 seq: 42,
156 fields: RequestFields::Text(TextFields {
157 sql: Some("SELECT 1".into()),
158 ..Default::default()
159 }),
160 };
161 let bytes = zerompk::to_msgpack_vec(&req).unwrap();
162 assert_eq!(FrameFormat::detect(bytes[0]), FrameFormat::MessagePack);
163
164 let decoded = decode_request(&bytes, FrameFormat::MessagePack).unwrap();
165 assert_eq!(decoded.op, OpCode::Sql);
166 assert_eq!(decoded.seq, 42);
167 }
168
169 #[test]
170 fn response_encode_json() {

Callers

nothing calls this directly

Calls 1

decode_requestFunction · 0.70

Tested by

no test coverage detected