diff options
| author | eunhhu <[email protected]> | 2026-10-19 00:40:55 +0100 |
|---|---|---|
| committer | eunhhu <[email protected]> | 2026-10-19 00:40:55 +0100 |
| commit | e0298482010b0f78398b3c94cb0d127db5042a78 (patch) | |
| tree | 8d0715d1ceee9719f93996c0e0b0fa69d0e9e6ed /tests/check.py | |
| parent | 9480b493e4b919245e84799417641e7ccb7401a1 (diff) | |
| download | aup-e0298482010b0f78398b3c94cb0d127db5042a78.tar.gz aup-e0298482010b0f78398b3c94cb0d127db5042a78.zip | |
Pure 027's 4f-4: a source of any size (files and standard input read whole), the compiler's tables raised to Pure's widths (4,096 states, 1,024 inputs, 4,096 views and handlers, 1,024 records, 16,384 record fields; 15 MB calloc'd, its unused rooms never touched) and its diagnostics saying so; at most 255 outputs (Pure's store counts them in a byte), a walked or folded list among the first 256 states (its argument's byte), said before Pure would refuse; a wide program checked: 301 states, 40 inputs, 70 views and 20 records in 48 KB of source, run to the last of each
Diffstat (limited to 'tests/check.py')
| -rw-r--r-- | tests/check.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/check.py b/tests/check.py index 05977e2..7d53e1d 100644 --- a/tests/check.py +++ b/tests/check.py @@ -185,7 +185,7 @@ DIAGNOSTICS = [ ('\n'.join(['fn f0(x) = x + 1'] + [f'fn f{i}(x) = f{i - 1}(f{i - 1}(x))' for i in range(1, 15)] + ['view v = f14(1)']) + '\n', '1:14', "program exceeds 65535 instructions (in fn 'f0' called at 2:15)"), ('view v = ' + '(' * 70 + '1' + ')' * 70 + '\n', '1:', 'expression nesting exceeds 64'), - ('state s = 0\n' * 1 + ''.join(f'state s{i} = 0\n' for i in range(32)), '33:7', 'at most 32 states are allowed'), + ('state s = 0\n' * 1 + ''.join(f'state s{i} = 0\n' for i in range(4096)), '4097:7', 'at most 4096 states are allowed'), # v0b: messages and types ('input m = message { a: u32 }\non m {\n reply m.a\n}\n', '3:9', 'reply takes bytes or text, not a number'), ('input m = message {\n a: float\n}\n', '2:6', 'field types are u32, i64, number, bool, bytes, text and list of a record'), @@ -2416,6 +2416,20 @@ def main(): report['diagnostics'] = len(DIAGNOSTICS) report['accepted_forms'] = len(ACCEPTED) + # No fixed counts but Pure's widths (Pure 027's 4f): 300 states, 40 inputs, 70 views and 20 records, in a source past + # 32 KB (40 KB of comments), compiled and run to the last of each. + wide = ''.join(f'record R{r} {{\n a = 0\n}}\n' for r in range(20)) + 'state items: list of R19\n' + wide += ''.join(f'state s{i} = 0\n' for i in range(300)) + ''.join(f'input m{i} = message {{ n: u32 }}\n' for i in range(40)) + wide += 'on m39 {\n s299 = s299 + m39.n\n items.append(R19 { a: m39.n })\n}\n' + wide += ''.join(f'view v{i} = s{i}\n' for i in range(69)) + 'view v69 = items.count\n' + wide += ''.join(f'# {i:05} ' + 'x' * 60 + '\n' for i in range(600)) + assert len(wide) > 40000 + (work / 'wide.aup').write_text(wide) + compile_module(aup, work / 'wide.aup', work / 'wide.pmod') + shown = json.loads(run(pure_run, work / 'wide.pmod', stdin='message m39 05000000\nmessage m39 02000000\n').stdout.splitlines()[-1]) + assert shown['error'] is None and shown['states']['s299'] == 7 and shown['views']['v69'] == 2, shown['states']['s299'] + report['wide_program'] = {'states': 301, 'inputs': 40, 'views': 70, 'records': 20, 'source_bytes': len(wide)} + # message like X is X's fields, written once: the same module, byte for byte. fields = ' title: text\n lane: u32\n to: {\n city: text\n }\n' body = 'on remote {\n n = remote.lane\n}\non tap.down {\n send changed { title: "t", lane: 1, to: { city: "c" } }\n}\n' |
