Skip to content

Commit

Permalink
Test the UndefMask type
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Mar 4, 2019
1 parent aa8c48a commit d32b7e5
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/test/run-pass-fulldeps/undef_mask.rs
@@ -0,0 +1,26 @@
// ignore-cross-compile
// ignore-stage1

#![feature(rustc_private)]

extern crate rustc;

use rustc::mir::interpret::UndefMask;
use rustc::ty::layout::Size;

fn main() {
let mut mask = UndefMask::new(Size::from_bytes(500));
assert!(!mask.get(Size::from_bytes(499)));
mask.set(Size::from_bytes(499), true);
assert!(mask.get(Size::from_bytes(499)));
mask.set_range_inbounds(Size::from_bytes(100), Size::from_bytes(256), true);
for i in 0..100 {
assert!(!mask.get(Size::from_bytes(i)));
}
for i in 100..256 {
assert!(mask.get(Size::from_bytes(i)));
}
for i in 256..499 {
assert!(!mask.get(Size::from_bytes(i)));
}
}

0 comments on commit d32b7e5

Please sign in to comment.