MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / test_ptmsetbuffersize

Function test_ptmsetbuffersize

tpm/src/lib.rs:422–436  ·  view source on GitHub ↗

PtmSetBufferSize Testing */

()

Source from the content-addressed store, hash-verified

420 #[test]
421 /* PtmSetBufferSize Testing */
422 fn test_ptmsetbuffersize() -> Result<()> {
423 let mut psbs: PtmSetBufferSize = PtmSetBufferSize::new(1024);
424 // Member type should be Request after initialization
425 assert_eq!(psbs.get_member_type(), MemberType::Request);
426 let buf: &[u8] = &[
427 0, 0x12, 0x34, 0x56, 0, 0, 0, 0xA, 0, 0, 0, 0xB, 0, 0, 0, 0xC,
428 ];
429 psbs.update_ptm_with_response(buf)?;
430 assert_eq!(psbs.get_member_type(), MemberType::Response);
431 assert_eq!(psbs.get_result_code(), 0x123456);
432 assert_eq!(psbs.resp.bufsize, 0xA);
433 assert_eq!(psbs.resp.minsize, 0xB);
434 assert_eq!(psbs.resp.maxsize, 0xC);
435 Ok(())
436 }
437}

Callers

nothing calls this directly

Calls 2

newFunction · 0.85

Tested by

no test coverage detected