summaryrefslogtreecommitdiff
path: root/tests/micropython/viper_ptr32_store_boundary.py
diff options
context:
space:
mode:
authorAngus Gratton <angus@redyak.com.au>2025-07-22 11:17:23 +1000
committerDamien George <damien@micropython.org>2025-07-24 15:50:34 +1000
commit096ff8b9ee216a8ca0345c00946799f8342570a6 (patch)
treef7e1f71c9427b7ee15569f8ff37653d4c29e7670 /tests/micropython/viper_ptr32_store_boundary.py
parent5d9ef6bfb696106f8052a44c1e392695e908eafa (diff)
tests/micropython: Rename viper boundary tests that depend on big int.
These tests all depend on generating arbitrarily long (>64-bit) integers. It would be possible to have these tests work in this case I think, as the results are always masked to shorter values. But quite fiddly. So just rename them so they are automatically skipped if the target doesn't have big int support. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
Diffstat (limited to 'tests/micropython/viper_ptr32_store_boundary.py')
-rw-r--r--tests/micropython/viper_ptr32_store_boundary.py58
1 files changed, 0 insertions, 58 deletions
diff --git a/tests/micropython/viper_ptr32_store_boundary.py b/tests/micropython/viper_ptr32_store_boundary.py
deleted file mode 100644
index 5109abb9d..000000000
--- a/tests/micropython/viper_ptr32_store_boundary.py
+++ /dev/null
@@ -1,58 +0,0 @@
-# Test boundary conditions for various architectures
-
-SET_TEMPLATE = """
-@micropython.viper
-def set{off}(dest: ptr32):
- dest[{off}] = {val}
-set{off}(buffer)
-print(hex(get_index(buffer, {off})))
-"""
-
-BIT_THRESHOLDS = (5, 8, 11, 12)
-SIZE = 4
-MASK = (1 << (8 * SIZE)) - 1
-
-
-@micropython.viper
-def set_index(dest: ptr32, i: int, val: uint):
- dest[i] = val
-
-
-def get_index(src, i):
- return (
- src[i * SIZE]
- + (src[(i * SIZE) + 1] << 8)
- + (src[(i * SIZE) + 2] << 16)
- + (src[(i * SIZE) + 3] << 24)
- )
-
-
-buffer = bytearray(((1 << max(BIT_THRESHOLDS) + 1) // 1024) * 1024)
-next = 1
-val = 0
-for bit in BIT_THRESHOLDS:
- print("---", bit)
- pre, idx, post = (
- (((1 << bit) - (2 * SIZE)) // SIZE),
- (((1 << bit) - (1 * SIZE)) // SIZE),
- ((1 << bit) // SIZE),
- )
- val = (val << 8) + next
- next += 1
- set_index(buffer, pre, val & MASK)
- val = (val << 8) + next
- next += 1
- set_index(buffer, idx, val & MASK)
- val = (val << 8) + next
- next += 1
- set_index(buffer, post, val & MASK)
- val = (val << 8) + next
- next += 1
- print(hex(get_index(buffer, pre)), hex(get_index(buffer, idx)), hex(get_index(buffer, post)))
- exec(SET_TEMPLATE.format(off=pre, val=val & MASK))
- val = (val << 8) + next
- next += 1
- exec(SET_TEMPLATE.format(off=idx, val=val & MASK))
- val = (val << 8) + next
- next += 1
- exec(SET_TEMPLATE.format(off=post, val=val & MASK))