()
| 499 | |
| 500 | #[test] |
| 501 | fn test_codec_8bytes_primitives() { |
| 502 | #[derive(Debug, PartialEq, Eq, PackedSize, EncodeLE, DecodeLE, EncodeBE, DecodeBE)] |
| 503 | struct A { |
| 504 | a: u64, |
| 505 | b: i64, |
| 506 | } |
| 507 | |
| 508 | let test = A { |
| 509 | a: 0x2F, |
| 510 | b: 0x2F000000_00000000, |
| 511 | }; |
| 512 | assert_eq!(A::PACKED_LEN, 16); |
| 513 | let mut bytes = [0; A::PACKED_LEN]; |
| 514 | |
| 515 | // LE |
| 516 | let size = test.encode_as_le_bytes(&mut bytes); |
| 517 | assert_eq!([47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47], bytes); |
| 518 | assert_eq!(A::PACKED_LEN, size); |
| 519 | |
| 520 | let test_back = A::decode_from_le_bytes(&bytes); |
| 521 | assert_eq!(test, test_back); |
| 522 | |
| 523 | //BE |
| 524 | let size = test.encode_as_be_bytes(&mut bytes); |
| 525 | assert_eq!([0, 0, 0, 0, 0, 0, 0, 47, 47, 0, 0, 0, 0, 0, 0, 0,], bytes); |
| 526 | assert_eq!(A::PACKED_LEN, size); |
| 527 | |
| 528 | let test_back = A::decode_from_be_bytes(&bytes); |
| 529 | assert_eq!(test, test_back); |
| 530 | } |
| 531 | |
| 532 | #[test] |
| 533 | fn test_codec_16bytes_primitives() { |
nothing calls this directly
no test coverage detected