22 lines
361 B
Rust
22 lines
361 B
Rust
|
|
#[test]
|
|
pub fn test_once() {
|
|
let mut i = 0;
|
|
for _ in 0..3 {
|
|
if x::once!() { i+= 1; }
|
|
if x::once!() { i+= 1; }
|
|
}
|
|
assert_eq!(i, 2);
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
|
pub fn test_chain() {
|
|
let a = 0x1337;
|
|
let b = [None,None,Some(&a)];
|
|
let c = [None,Some(&b), None];
|
|
assert_eq!(0x1337, x::ptr_chain!(&c as *const _, 0x8, 0x10, 0x0));
|
|
}
|
|
|