aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-10-18 18:52:48 +0100
committereunhhu <[email protected]>2026-10-18 18:52:48 +0100
commite8b3499289022c8729900a58ed218d961a85fec8 (patch)
treefef2531be1dfc5a1568c3e2545430a8d5718d26f /tests
parent531200a6c24842784fad68102878c3ab77391b13 (diff)
downloadpure-e8b3499289022c8729900a58ed218d961a85fec8.tar.gz
pure-e8b3499289022c8729900a58ed218d961a85fec8.zip
Module format and executor: 027's 4b-1, a record field holding bytes (type 5): held as a text is but for UTF-8, its default a constant; a function's bytes in a signature this type too (PURE_SIGNATURE_BYTES gone); no list keyed by bytes; replaced, a text field becomes a bytes field keeping its value (pure_cell_as, kinds_carry); images' headers take its kind; the JSON edge reads it from a string; pure-run shows it as hex; an append asks a record's fields held as bytes from a mask the load makes (record_held) instead of each field's type twice, so b32 runs fewer instructions than b30 (BFS without batches -1.05%, join -0.25%, BFS with batches -0.36%, the rest within 0.04%; the bank's queries s30 against s32 -0.01% to +0.30%); unit test bytes_fields (bytes not UTF-8, a text field replaced by a bytes field, three refused); server_trees with a bytes field; 008 and 027
Diffstat (limited to 'tests')
-rw-r--r--tests/check.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/check.py b/tests/check.py
index 52aa17d..8814add 100644
--- a/tests/check.py
+++ b/tests/check.py
@@ -3640,6 +3640,7 @@ def server_rows(aup, pure, work):
TREES = '''
record Node {
name: text
+ tag: bytes = "-"
n = 0
kids: list of Node
}
@@ -3655,7 +3656,7 @@ input tree = message {
fn walk(x, depth) {
nodes = nodes + 1
total = total + x.n
- name_bytes = name_bytes + x.name.bytes
+ name_bytes = name_bytes + x.name.bytes + x.tag.bytes
if depth > deepest { deepest = depth }
for k in x.kids { walk(k, depth + 1) }
}
@@ -3675,7 +3676,8 @@ view named = name_bytes
def server_trees(aup, pure, work):
"""A message's rows whose records hold lists (027's 4a): a JSON forest
read straight into the event's lists, nested to any depth up to 64, and
- walked by a function that calls itself. Random forests (names with
+ walked by a function that calls itself, a field of bytes among them
+ (027's 4b). Random forests (names with
escapes and characters past ASCII, fields left out taking their
defaults) against a model walking them in the same order; a require
refusing one leaves everything as it was; malformed trees (a list field
@@ -3707,6 +3709,8 @@ def server_trees(aup, pure, work):
roots = []
for _ in range(rng.randrange(4 if depth < 6 else 1)):
node = {'name': rng.choice(names)}
+ if rng.random() < 0.5:
+ node['tag'] = rng.choice(names) # bytes, from a JSON string
if rng.random() < 0.8:
node['n'] = rng.randrange(-1000, 1000) / 8
kids = forest(depth + 1)
@@ -3721,7 +3725,7 @@ def server_trees(aup, pure, work):
into[0] += 1
into[1] += node.get('n', 0)
into[2] = max(into[2], depth)
- into[3] += len(node['name'].encode())
+ into[3] += len(node['name'].encode()) + len(node.get('tag', '-').encode())
for k in node.get('kids', []):
walk(k, depth + 1, into)