()
| 254 | |
| 255 | #[test] |
| 256 | fn test_request_encode_decode() { |
| 257 | let requests = [ |
| 258 | BitswapRequest { |
| 259 | ty: RequestType::Have, |
| 260 | cid: create_cid(&b"have_request"[..]), |
| 261 | }, |
| 262 | BitswapRequest { |
| 263 | ty: RequestType::Block, |
| 264 | cid: create_cid(&b"block_request"[..]), |
| 265 | }, |
| 266 | ]; |
| 267 | let mut buf = Vec::with_capacity(MAX_CID_SIZE + 1); |
| 268 | for request in &requests { |
| 269 | buf.clear(); |
| 270 | request.write_to(&mut buf).unwrap(); |
| 271 | assert_eq!(&BitswapRequest::from_bytes(&buf).unwrap(), request); |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | #[test] |
| 276 | fn test_response_encode_decode() { |
nothing calls this directly
no test coverage detected