MCPcopy Create free account
hub / github.com/RustCrypto/utils / eager_buffer_exception_safety

Function eager_buffer_exception_safety

block-buffer/tests/mod.rs:384–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

382
383#[test]
384fn eager_buffer_exception_safety() {
385 let mut buf = EagerBuffer::<U4>::default();
386
387 let res = catch_unwind(AssertUnwindSafe(|| {
388 buf.digest_blocks(b"ab", |_| {});
389 buf.digest_blocks(b"cd", |_| panic!("compression panic"));
390 }));
391
392 assert!(res.is_err());
393 let _ = buf.get_pos();
394
395 let mut buf = EagerBuffer::<U4>::default();
396
397 let res = catch_unwind(AssertUnwindSafe(|| {
398 buf.digest_pad(0x80, &[0xFF; 2], |_| panic!("compression panic"));
399 }));
400
401 assert!(res.is_err());
402 let _ = buf.get_pos();
403}
404
405#[test]
406fn read_buffer_exception_safety() {

Callers

nothing calls this directly

Calls 4

defaultFunction · 0.85
digest_blocksMethod · 0.80
digest_padMethod · 0.80
get_posMethod · 0.45

Tested by

no test coverage detected