Files
x2/x/tests/test_core.rs
Intege-rs 03066e2e55 v0.0.0b
2024-11-13 21:41:26 -05:00

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));
}