]> git.proxmox.com Git - rustc.git/blame - compiler/rustc_middle/src/mir/interpret/allocation/tests.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / compiler / rustc_middle / src / mir / interpret / allocation / tests.rs
CommitLineData
487cf647
FG
1use super::*;
2
3#[test]
4fn uninit_mask() {
5 let mut mask = InitMask::new(Size::from_bytes(500), false);
6 assert!(!mask.get(Size::from_bytes(499)));
7 mask.set_range(alloc_range(Size::from_bytes(499), Size::from_bytes(1)), true);
8 assert!(mask.get(Size::from_bytes(499)));
9 mask.set_range((100..256).into(), true);
10 for i in 0..100 {
11 assert!(!mask.get(Size::from_bytes(i)), "{i} should not be set");
12 }
13 for i in 100..256 {
14 assert!(mask.get(Size::from_bytes(i)), "{i} should be set");
15 }
16 for i in 256..499 {
17 assert!(!mask.get(Size::from_bytes(i)), "{i} should not be set");
18 }
19}