Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tests/universal/translation/make_fixtures.py # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tests / universal / translation / make_fixtures.py` 20 lines ยท 1406 bytes Raw Blame History 1 #!/usr/bin/env python3 2 """Fixture set F1 (spec/universal/translation-v1.md section 8): the exact sources of the reviewed C import 3 gate, identified by SHA256. `--check` fails if fixtures-f1.json no longer matches c_import_gate.py.""" 4 import hashlib, importlib.util, json, sys 5 from pathlib import Path 6 ROOT = Path(__file__).resolve().parents[3] 7 spec = importlib.util.spec_from_file_location('gate', ROOT / 'tests/universal/c_import_gate.py') 8 g = importlib.util.module_from_spec(spec); spec.loader.exec_module(g) 9 pos = [{'id': 'F1-P%02d' % i, 'sha256': hashlib.sha256(t.encode()).hexdigest(), 'name': n, 'inputs': k, 10 'source': t} for i, (t, n, k) in enumerate(g.POSITIVES)] 11 neg = [{'id': 'F1-N%02d' % i, 'sha256': hashlib.sha256(b).hexdigest(), 'bytes': len(b)} for i, b in enumerate(g.NEGATIVES)] 12 doc = {'schema': 'omega.universal.fixtures.v1', 'set': 'F1', 'contract': 'spec/universal/translation-v1.md', 13 'from': 'tests/universal/c_import_gate.py', 'positives': pos, 'refusals': neg} 14 out = ROOT / 'tests/universal/translation/fixtures-f1.json' 15 text = json.dumps(doc, indent=1, ensure_ascii=False) + '\n' 16 if sys.argv[1:] == ['--check']: 17 ok = out.read_text() == text 18 print('F1 fixtures %s: %d positives, %d refusals' % ('match' if ok else 'DIFFER', len(pos), len(neg))) 19 sys.exit(0 if ok else 1) 20 out.write_text(text); print('wrote', out, len(pos), 'positives', len(neg), 'refusals')