| |
| |
| |
| |
| @@ -1,6 +1,6 @@ |
| from smol_evm.constants import MAX_UINT256 |
| from smol_evm.context import ExecutionContext |
| -from smol_evm.opcodes import SHR |
| +from smol_evm.opcodes import SHL, SHR |
| |
| import pytest |
| |
| @@ -10,6 +10,37 @@ |
| def context() -> ExecutionContext: |
| return ExecutionContext() |
| |
| + |
| +def test_shl_simple(context): |
| + SHL.execute(with_stack_contents(context, [16, 1])) |
| + assert context.stack.pop() == 32 |
| + |
| + |
| +def test_shl_big(context): |
| + SHL.execute(with_stack_contents(context, [16, 5])) |
| + assert context.stack.pop() == 512 |
| + |
| + |
| +def test_shl_by_zero(context): |
| + SHL.execute(with_stack_contents(context, [16, 0])) |
| + assert context.stack.pop() == 16 |
| + |
| + |
| +def test_shl_non_power_of_two(context): |
| + SHL.execute(with_stack_contents(context, [15, 1])) |
| + assert context.stack.pop() == 30 |
| + |
| + |
| +def test_shl_max(context): |
| + SHL.execute(with_stack_contents(context, [2 ** 256 - 1, 1])) |
| + assert context.stack.pop() == (2 ** 256 - 1) - 1 |
| + |
| + |
| +def test_shl_by_max(context): |
| + SHL.execute(with_stack_contents(context, [2 ** 256 - 1, 2 ** 256 - 1])) |
| + assert context.stack.pop() == 0 |
| + |
| + |
| def test_shr_simple(context): |
| SHR.execute(with_stack_contents(context, [16, 1])) |
| assert context.stack.pop() == 8 |
| |
| new file mode 100644 |
| |
| |
| @@ -0,0 +1,4 @@ |
| +H4sIAAAAAAAAA+3STQrCMBCG4ax7irmANbFNexyxtmDB/mCi4u2NdVER1E2LiO+zyAxJIANf4uJY |
| +78t11Z6Wai46yK0davBch97YlTG5XiWJUdoYm6dK7GwTPTg6vzmIqEPX+Xf3Pp3/qHjM31fOr7dd |
| +02zaMna76d74mH+Wj/nrLOSfZsYq0dON8Nqf578tZQi+qMqov/hd1yayaCS0YVNui7t/jKL259pV |
| +cX+RxSn69tgAAAAAAAAAAAAAAAAAgiu4iUYAACgAAA== |
| |
| new file mode 100755 |
| |
| |
| @@ -0,0 +1,6 @@ |
| +#!/usr/bin/env bash |
| + |
| +set -uo pipefail |
| +cd /testbed || exit 1 |
| +base64 -d mimo_build_env.tar.gz.b64 | tar -xzf - -C /testbed || exit 1 |
| +exec bash -lc 'cd /testbed && bash -eo pipefail /testbed/.build_env/test_command.sh' |
|
|