~james/remy

test(compiler): exhaustively compare optimised small expressions

commit
175b8b22df89336d3a03eb1209d760f6f426315b browse tree
parent
dba8e6d26f3995a03c1c6766135e705d3045ebec
author
james <j@cpl0.zip>
signature
Verified ~james signed with a key registered by ~james
date
2026-10-31 12:00 UTC

1 files changed, +8 −0

tests/native.py modified

@@ -1,4 +1,5 @@
11 import ctypes
2+import itertools
23 import mmap
34 import multiprocessing
45 import resource
@@ -122,6 +123,13 @@ def main():
122123 cases += [("let", "a", ("+", "x", 3), ("+", "y", ("let", "b", "t", ("*", "a", "b")))),
123124 ("let", "x", "y", ("if", "t", ("+", "x", 1), ("-", "x", 1)))]
124125 cases += [generate(rng, 5, ["x", "y", "t"]) for _ in range(117)]
126+ atoms = (0,1,MASK,'x','y','t')
127+ exhaustive = list(atoms)
128+ exhaustive += [(op,a,b) for op in OPERATORS for a,b in itertools.product(atoms,repeat=2)]
129+ exhaustive += [('if',c,a,b) for c,a,b in itertools.product(atoms,repeat=3)]
130+ exhaustive += [('let','a',value,body) for value in atoms for body in (*atoms,'a')]
131+ assert len(exhaustive) == 588
132+ cases += exhaustive
125133 comparisons = 0
126134 with tempfile.TemporaryDirectory() as directory:
127135 path, binary = Path(directory) / "source", Path(directory) / "binary"