|
|
@ -107,7 +107,7 @@ BOOST_AUTO_TEST_CASE(different_argument_numbers) |
|
|
|
byte(Instruction::DUP3), |
|
|
|
byte(Instruction::SWAP1), // assign b to d
|
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0xa + shift, // jump to return
|
|
|
|
byte(Instruction::PUSH1), byte(0xa + shift), // jump to return
|
|
|
|
byte(Instruction::JUMP), |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::SWAP4), // store d and fetch return address
|
|
|
@ -119,11 +119,11 @@ BOOST_AUTO_TEST_CASE(different_argument_numbers) |
|
|
|
byte(Instruction::JUMPDEST), // beginning of g
|
|
|
|
byte(Instruction::PUSH1), 0x0, |
|
|
|
byte(Instruction::DUP1), // initialized e and h
|
|
|
|
byte(Instruction::PUSH1), 0x20 + shift, // ret address
|
|
|
|
byte(Instruction::PUSH1), byte(0x20 + shift), // ret address
|
|
|
|
byte(Instruction::PUSH1), 0x1, |
|
|
|
byte(Instruction::PUSH1), 0x2, |
|
|
|
byte(Instruction::PUSH1), 0x3, |
|
|
|
byte(Instruction::PUSH1), 0x1 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x1 + shift), |
|
|
|
// stack here: ret e h 0x20 1 2 3 0x1
|
|
|
|
byte(Instruction::JUMP), |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
@ -158,24 +158,24 @@ BOOST_AUTO_TEST_CASE(ifStatement) |
|
|
|
bytes expectation({byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::PUSH1), 0x0, |
|
|
|
byte(Instruction::DUP1), |
|
|
|
byte(Instruction::PUSH1), 0x1b + shift, // "true" target
|
|
|
|
byte(Instruction::PUSH1), byte(0x1b + shift), // "true" target
|
|
|
|
byte(Instruction::JUMPI), |
|
|
|
// new check "else if" condition
|
|
|
|
byte(Instruction::DUP1), |
|
|
|
byte(Instruction::ISZERO), |
|
|
|
byte(Instruction::PUSH1), 0x13 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x13 + shift), |
|
|
|
byte(Instruction::JUMPI), |
|
|
|
// "else" body
|
|
|
|
byte(Instruction::PUSH1), 0x4f, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0x17 + shift, // exit path of second part
|
|
|
|
byte(Instruction::PUSH1), byte(0x17 + shift), // exit path of second part
|
|
|
|
byte(Instruction::JUMP), |
|
|
|
// "else if" body
|
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::PUSH1), 0x4e, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::PUSH1), 0x1f + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x1f + shift), |
|
|
|
byte(Instruction::JUMP), |
|
|
|
// "if" body
|
|
|
|
byte(Instruction::JUMPDEST), |
|
|
@ -201,23 +201,23 @@ BOOST_AUTO_TEST_CASE(loops) |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::PUSH1), 0x1, |
|
|
|
byte(Instruction::ISZERO), |
|
|
|
byte(Instruction::PUSH1), 0x21 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x21 + shift), |
|
|
|
byte(Instruction::JUMPI), |
|
|
|
byte(Instruction::PUSH1), 0x1, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0x21 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x21 + shift), |
|
|
|
byte(Instruction::JUMP), // break
|
|
|
|
byte(Instruction::PUSH1), 0x2, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0x2 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x2 + shift), |
|
|
|
byte(Instruction::JUMP), // continue
|
|
|
|
byte(Instruction::PUSH1), 0x3, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0x22 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x22 + shift), |
|
|
|
byte(Instruction::JUMP), // return
|
|
|
|
byte(Instruction::PUSH1), 0x4, |
|
|
|
byte(Instruction::POP), |
|
|
|
byte(Instruction::PUSH1), 0x2 + shift, |
|
|
|
byte(Instruction::PUSH1), byte(0x2 + shift), |
|
|
|
byte(Instruction::JUMP), |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|
byte(Instruction::JUMPDEST), |
|
|
|