upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/test_cfg_structure.py
diff options
context:
space:
mode:
authortedin7 <tommasoderosa94@gmail.com>2026-11-23 02:57:33 +0100
committertedin7 <tommasoderosa94@gmail.com>2026-11-23 02:57:33 +0100
commit4e3517479b2cece8dbbf190f558b740c7de922df (patch)
tree9315b4745f60736226e604ceec153269a4da1b23 /tests/test_cfg_structure.py
parent03b09a086592a197db64d91655c6e65c30764d96 (diff)
test_cfg_structure: the split-graph walk reuses the cached branch choices
split_choose built a random.Random(f"{seed}/{block}/{visit}") for every branch of 1.6 million steps, the exact value branch_index already caches. Same choices, so the same 18228 structured graphs, 1772 irreducible, 1755 split and 12692 with loops; 42.1 s -> 20.9 s.
Diffstat (limited to 'tests/test_cfg_structure.py')
-rw-r--r--tests/test_cfg_structure.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test_cfg_structure.py b/tests/test_cfg_structure.py
index 116174b8b..d4fa49058 100644
--- a/tests/test_cfg_structure.py
+++ b/tests/test_cfg_structure.py
@@ -134,7 +134,7 @@ def _check_random_graphs():
134 opts = _ns[b] 134 opts = _ns[b]
135 if not opts: 135 if not opts:
136 return S.END 136 return S.END
137 return opts[random.Random(f"{_seed}/{ob}/{k}").randrange(len(opts))] 137 return opts[branch_index(_seed, ob, k, len(opts))]
138 138
139 got = [orig[b] for b in S.run(stree, split_choose, 200)] 139 got = [orig[b] for b in S.run(stree, split_choose, 200)]
140 assert got == want, f"split graph {succ} seed {seed}: tree ran {got}, graph runs {want}" 140 assert got == want, f"split graph {succ} seed {seed}: tree ran {got}, graph runs {want}"