Skip to content

Commit

Permalink
Fix removed lines from merge
Browse files Browse the repository at this point in the history
  • Loading branch information
b-j-roberts committed Jul 26, 2024
1 parent 179a01a commit 6c643ac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/opcodes/opcodes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ pub mod Opcode {
fn opcode_max(ref engine: Engine) {
let a = engine.dstack.pop_int();
let b = engine.dstack.pop_int();
engine.dstack.push_int(if a > b { a } else { b });
engine.dstack.push_int(if a > b {
a
} else {
b
});
}
}
2 changes: 2 additions & 0 deletions src/opcodes/tests/test_opcodes.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn test_op_add() {
assert_eq!(dstack, expected_stack.span(), "Stack is not equal to expected");
}

#[test]
fn test_op_max() {
let program = "OP_1 OP_0 OP_MAX";
let mut compiler = CompilerTraitImpl::new();
Expand All @@ -67,6 +68,7 @@ fn test_op_max() {

let expected_stack = array!["\0\0\0\0\0\0\0\x01"];
assert_eq!(dstack, expected_stack.span(), "Stack is not equal to expected");
}

fn test_op_depth_empty_stack() {
let program = "OP_DEPTH";
Expand Down

0 comments on commit 6c643ac

Please sign in to comment.