aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-06 04:14:29 +0100
committereunhhu <[email protected]>2026-10-06 04:14:29 +0100
commitc67f98812b8db0ffe6a73f7d863126cd90f66e56 (patch)
tree4a17fb9cb1e556d3e0e7726865d59f3acafbb7ec /tests
parent06c2978ea0cba0ee08f371ce8ad8717c7fbe9a4f (diff)
downloadpure-c67f98812b8db0ffe6a73f7d863126cd90f66e56.tar.gz
pure-c67f98812b8db0ffe6a73f7d863126cd90f66e56.zip
Batch: a walk (EACH) whose block has batch forms runs a batch of its items at a time: each lane an item's place (ROW of the walked list affine), its work counted as it opened, its place moved past the batch; no append to the walked list. module_tier makes walks of rounds apart (f, g, h, slices of g; seeds 1, 2, 3, 5, 23 alike: 1,891 walk batches in seed 1); BATCH_SOURCE walks a slice
Diffstat (limited to 'tests')
-rw-r--r--tests/check.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/check.py b/tests/check.py
index f439e73..744b505 100644
--- a/tests/check.py
+++ b/tests/check.py
@@ -1179,7 +1179,8 @@ on go {
# 0 divided by at round q (a fault halfway through a batch: the executor's,
# at its round), each round reading the last one's set (not apart: run one
# by one), keys going down with an if and an else, two sets of one field,
-# sums into three cells in turn (the column widened as they grow).
+# sums into three cells in turn (the column widened as they grow), a walk
+# of a slice setting another field at each item.
BATCH_SOURCE = """record Cell {
at = 0
v = 0
@@ -1214,6 +1215,9 @@ on go {
for k in 0 .. go.n {
t[k - floor(k / 3) * 3].v = t[k - floor(k / 3) * 3].v + k * 1000000
}
+ for c in t[3 .. go.n - 1] {
+ t[c.at].w = c.v + c.at
+ }
for k in 0 .. go.n {
t[k].w = 1000 / (k - go.q)
}
@@ -1420,7 +1424,7 @@ def tier_program(rng):
keys read by key alone (full, or not where keys are left out), ifs and
breaks, loops whose rounds are apart (a batch's, 024), some with a loop
run in each and reductions (ra, rb, rc), some appending (e, d), some
- with a recurrence (x1) ahead, with what fails
+ with a recurrence (x1) ahead, walks of rounds apart, with what fails
(a key not there, not whole, 0 divided by, a cell past its column's
width) as likely as not."""
names = iter('jklpqrxyz')
@@ -1470,7 +1474,7 @@ def tier_program(rng):
lines = []
for _ in range(rng.randint(1, 3)):
kind = rng.choice(['s', 's', 'u', 'acc', 'if', 'loop', 'walk', 'set', 'set', 'break', 'sweep', 'lanes', 'lanes', 'nest', 'nest',
- 'recur', 'recur'] if depth < 3 else ['s', 'u', 'set', 'break'])
+ 'recur', 'recur', 'walks', 'walks'] if depth < 3 else ['s', 'u', 'set', 'break'])
pad = ' ' * indent
if kind == 's':
lines.append(f'{pad}s = s + {number(1, loops)}')
@@ -1578,6 +1582,24 @@ def tier_program(rng):
else:
lines.append(f'{pad} ra = ra + w{name}')
lines.append(f'{pad}}}')
+ elif kind == 'walks' and 'c' not in loops: # a walk's rounds apart: its items read at their places (024)
+ walked = rng.choice(['f', 'g', 'h', 'f', f'g[{rng.choice(["0", "go.q", "3"])} .. {rng.choice(["go.n", "go.m", "50"])}]'])
+ inner = loops + ['c']
+ lines.append(f'{pad}for c in {walked} {{')
+ lines.append(f'{pad} let wc = {number(1, inner)}')
+ for _ in range(rng.randint(1, 3)):
+ pick = rng.random()
+ if pick < 0.3:
+ lines.append(f'{pad} t[{rng.choice(["c.v", "c.at", "wc", key(2, inner)])}].v = {rng.choice(["wc", "c.v", number(1, inner)])}')
+ elif pick < 0.5:
+ lines.append(f'{pad} ra = ra + {rng.choice(["c.v", "wc", "c.at"])}')
+ elif pick < 0.65:
+ lines.append(f'{pad} e.append(Cell {{ at: c.at, v: wc }})')
+ elif pick < 0.8:
+ lines.append(f'{pad} if {cond(1, inner)} {{ t[{rng.choice(["c.v", "wc"])}].v = c.at }}')
+ else:
+ lines.append(f'{pad} rb = {rng.choice(["max", "min"])}(rb, {rng.choice(["c.v", "wc"])})')
+ lines.append(f'{pad}}}')
elif kind == 'walk' and 'c' not in loops:
lines.append(f'{pad}for c in f {{')
lines += statements(depth + 1, loops + ['c'], indent + 1, True)