block: qcow: Add AlignedBuf size rounding test

Verify that AlignedBuf rounds the allocation size up to the
requested alignment. Passes under miri.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-04-14 18:19:02 +02:00
committed by Rob Bradford
parent a84a0b8b25
commit dc0e003be0

View File

@@ -1903,4 +1903,13 @@ mod unit_tests {
assert_eq!(abuf.as_slice(size), &pattern[..]);
}
}
#[test]
fn test_aligned_buf_size_rounds_up() {
let abuf = AlignedBuf::new(1, 512).unwrap();
assert_eq!(abuf.layout().size(), 512);
let abuf = AlignedBuf::new(513, 512).unwrap();
assert_eq!(abuf.layout().size(), 1024);
}
}