aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check.py
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-28 05:01:23 +0100
committereunhhu <[email protected]>2026-09-28 05:01:23 +0100
commit15f0114d6a7da0a4f63028db12cac62c5f9cc922 (patch)
tree0d896ddd1d2925a716c2a08a706f8a0f74f35c40 /tests/check.py
parentadc4e5724c926cac4ecb8dc3a58a5f9b4d1b9b81 (diff)
downloadpure-15f0114d6a7da0a4f63028db12cac62c5f9cc922.tar.gz
pure-15f0114d6a7da0a4f63028db12cac62c5f9cc922.zip
Give an event locals
LOCAL_LOAD and LOCAL_STORE name one of an event's 64 slots, what it holds (a number, or an index of a list) and that list: slots start at 0 when an event begins, are shared by its handlers, the walks in them and the folds in those, and are never saved nor in the states' namespace. A handler uses a slot for one thing, so its type is verified as a state's is; views have no locals (IN_LOCALS: a handler's block, a walk in it, a fold in either; stores only in a handler and its walks). A fold reading a local still runs a leaf at a time (one value for every item) and a shaped fold takes one only on its key's side. The signature table's where widens to 16 bits. locals checks a handler that sums items into a local in a walk, counts in a fold the items below it, keeps an index in a local and reads it back, over 80 events against a model, and five refusals. server_rows' shop now takes stock through an index local and counts in one.
Diffstat (limited to 'tests/check.py')
-rw-r--r--tests/check.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/check.py b/tests/check.py
index 2020363..4387120 100644
--- a/tests/check.py
+++ b/tests/check.py
@@ -1059,12 +1059,15 @@ on restock {
}
}
on order {
+ let taken = 0
for l in order.lines {
- stock[l.item].left = stock[l.item].left - l.qty
- require stock[l.item].left >= 0
+ let s = stock[l.item]
+ s.left = s.left - l.qty
+ require s.left >= 0
log.append(Entry { item: l.item, qty: l.qty, note: l.note })
+ taken = taken + 1
}
- orders = orders + order.lines.count
+ orders = orders + taken
}
on clean {
for s in stock where s.left < clean.below {