Skip to content

Commit 2a2eb5d

Browse files
andyclaude
andcommitted
tests/symmetry: add the standalone helper the diagram test needs
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFMUNbw2UpRPmgsqviAowb
1 parent fa34915 commit 2a2eb5d

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎tests/symmetry/run_tests.py‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,25 @@ def checkGroup(name, h, classes, counts, irreps, report):
256256
% (name, classes[a], classes[b], total, want))
257257

258258

259+
def standalone(name, sources, args=()):
260+
"""Compile and run one C++ test that needs no build tree."""
261+
out = os.path.join(HERE, name)
262+
cmd = (["g++", "-O2", "-w", "-I", os.path.join(ROOT, "include"),
263+
"-o", out, os.path.join(HERE, name + ".C")]
264+
+ [os.path.join(ROOT, s) for s in sources])
265+
build = subprocess.run(cmd, capture_output=True, text=True)
266+
if build.returncode != 0:
267+
print(" could not build %s:" % name)
268+
print(build.stderr)
269+
return 1
270+
run = subprocess.run([out] + list(args), capture_output=True, text=True)
271+
print(run.stdout, end="")
272+
if run.stderr:
273+
print(run.stderr, end="")
274+
os.unlink(out)
275+
return run.returncode
276+
277+
259278
def checkLoader(tablePath, verbose):
260279
"""Does the C++ loader read the same file faithfully?
261280

0 commit comments

Comments
 (0)