MCPcopy Create free account
hub / github.com/SoftbearStudios/bitcode / test_pack_bytes_u8

Function test_pack_bytes_u8

src/pack.rs:504–517  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

502
503 #[test]
504 fn test_pack_bytes_u8() {
505 assert_eq!(pack_bytes(&[1u8, 2, 3, 4, 5, 6, 7]).len(), 5);
506 assert_eq!(pack_bytes(&[201u8, 202, 203, 204, 205, 206, 207]).len(), 6);
507
508 for max in 0..255u8 {
509 for sub in [1, 2, 3, 4, 5, 15, 255] {
510 let min = max.saturating_sub(sub);
511 let original = [min, min, min, min, min, min, min, max];
512 let packed = pack_bytes(&original);
513 let unpacked = unpack_bytes(&packed, original.len());
514 assert_eq!(original.as_slice(), unpacked.as_slice());
515 }
516 }
517 }
518
519 #[test]
520 fn test_pack_bytes_i8() {

Callers

nothing calls this directly

Calls 3

pack_bytesFunction · 0.85
unpack_bytesFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected