aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/call_stack/test_call_stack.py
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2024-04-12 14:57:45 +0300
committerJan Tuomi <jan@jantuomi.fi>2024-04-12 14:57:45 +0300
commit4f78086920cd4e2cee6d970decaee7025875f2a9 (patch)
tree1ef780401e5e26c20649c90e8713c02fc0fe90d6 /test/e2e/call_stack/test_call_stack.py
parent0603e19435b4304fabd91f840325a153ce31cae2 (diff)
Implement signed multiplication
Diffstat (limited to 'test/e2e/call_stack/test_call_stack.py')
-rw-r--r--test/e2e/call_stack/test_call_stack.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/e2e/call_stack/test_call_stack.py b/test/e2e/call_stack/test_call_stack.py
index 3895f5c..02897f9 100644
--- a/test/e2e/call_stack/test_call_stack.py
+++ b/test/e2e/call_stack/test_call_stack.py
@@ -21,6 +21,12 @@ def run_mul(a: int, b: int) -> int:
return machine.rg.value
+def test_mul_0():
+ expected = 0
+ received = run_mul(0, -100)
+
+ assert expected == received
+
def test_mul_1():
expected = 30
received = run_mul(5, 6)
@@ -32,6 +38,8 @@ def test_mul_2():
b = 200
expected = a * b
received = run_mul(a, b)
+ # interpret received as a 16 bit signed integer, using powers of two in the math
+ received = received if received < 2**15 else received - 2**16
assert expected == received