Fix bug in right-shifts.
This commit is contained in:
parent
a72f797da1
commit
3902e49a7d
@ -1280,7 +1280,7 @@ pub fn run_builtin_op_assignment(
|
||||
"/=" => return Ok(Some(*x /= y)),
|
||||
"%=" => return Ok(Some(*x %= y)),
|
||||
"~=" => return Ok(Some(*x = x.pow(y as u32))),
|
||||
">>=" => return Ok(Some(*x = *x << y)),
|
||||
">>=" => return Ok(Some(*x = *x >> y)),
|
||||
"<<=" => return Ok(Some(*x = *x << y)),
|
||||
_ => (),
|
||||
}
|
||||
|
@ -45,14 +45,14 @@ fn test_divide_equals() -> Result<(), Box<EvalAltResult>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_left_shift_equals() -> Result<(), Box<EvalAltResult>> {
|
||||
fn test_right_shift_equals() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
assert_eq!(engine.eval::<INT>("let x = 9; x >>=1; x")?, 4);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_right_shift_equals() -> Result<(), Box<EvalAltResult>> {
|
||||
fn test_left_shift_equals() -> Result<(), Box<EvalAltResult>> {
|
||||
let engine = Engine::new();
|
||||
assert_eq!(engine.eval::<INT>("let x = 4; x <<= 2; x")?, 16);
|
||||
Ok(())
|
||||
|
Loading…
Reference in New Issue
Block a user