rhai/tests/bit_shift.rs
2021-03-08 15:55:26 +08:00

16 lines
364 B
Rust

use rhai::{Engine, EvalAltResult, INT};
#[test]
fn test_left_shift() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("4 << 2")?, 16);
Ok(())
}
#[test]
fn test_right_shift() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert_eq!(engine.eval::<INT>("9 >> 1")?, 4);
Ok(())
}