File size: 2,171 Bytes
36b3cb8 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | diff --git a/tests/test_bitwise.py b/tests/test_bitwise.py
index 8e76db2..60aacdc 100644
--- a/tests/test_bitwise.py
+++ b/tests/test_bitwise.py
@@ -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
diff --git a/mimo_build_env.tar.gz.b64 b/mimo_build_env.tar.gz.b64
new file mode 100644
--- /dev/null
+++ b/mimo_build_env.tar.gz.b64
@@ -0,0 +1,4 @@
+H4sIAAAAAAAAA+3STQrCMBCG4ax7irmANbFNexyxtmDB/mCi4u2NdVER1E2LiO+zyAxJIANf4uJY
+78t11Z6Wai46yK0davBch97YlTG5XiWJUdoYm6dK7GwTPTg6vzmIqEPX+Xf3Pp3/qHjM31fOr7dd
+02zaMna76d74mH+Wj/nrLOSfZsYq0dON8Nqf578tZQi+qMqov/hd1yayaCS0YVNui7t/jKL259pV
+cX+RxSn69tgAAAAAAAAAAAAAAAAAgiu4iUYAACgAAA==
diff --git a/mimo_test_command.sh b/mimo_test_command.sh
new file mode 100755
--- /dev/null
+++ b/mimo_test_command.sh
@@ -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'
|