use bebytes::BeBytes;
#[derive(BeBytes, Debug, PartialEq)]
struct WithoutAuto {
p: u64, #[bits(16)]
f: u16, }
#[derive(BeBytes, Debug, PartialEq)]
struct WithBitFields {
p: u64, #[bits(1)]
e: u8, #[bits(7)]
x: u8, #[bits(16)]
f: u16, }
#[test]
fn test_check_optimization() {
let s1 = WithoutAuto { p: 0, f: 0x1234 };
let b1 = s1.to_be_bytes();
assert_eq!(b1.len(), 10);
let s2 = WithBitFields {
p: 0,
e: 1,
x: 0x55,
f: 0x5678,
};
let b2 = s2.to_be_bytes();
assert_eq!(b2.len(), 11);
println!("Tests pass - optimization behavior is correct");
}