-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
22 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
mod init_mask; | ||
mod provenance_map; | ||
#[cfg(test)] | ||
mod tests; | ||
|
||
use std::borrow::Cow; | ||
use std::fmt; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
compiler/rustc_middle/src/mir/interpret/allocation/tests.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use super::*; | ||
|
||
#[test] | ||
fn uninit_mask() { | ||
let mut mask = InitMask::new(Size::from_bytes(500), false); | ||
assert!(!mask.get(Size::from_bytes(499))); | ||
mask.set_range(alloc_range(Size::from_bytes(499), Size::from_bytes(1)), true); | ||
assert!(mask.get(Size::from_bytes(499))); | ||
mask.set_range((100..256).into(), true); | ||
for i in 0..100 { | ||
assert!(!mask.get(Size::from_bytes(i)), "{i} should not be set"); | ||
} | ||
for i in 100..256 { | ||
assert!(mask.get(Size::from_bytes(i)), "{i} should be set"); | ||
} | ||
for i in 256..499 { | ||
assert!(!mask.get(Size::from_bytes(i)), "{i} should not be set"); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.