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-bridge/blob/main/tests/robustness.py # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / tests / robustness.py` 25 lines ยท 1560 bytes Raw Blame History 1 """Adversarial source boundaries; no accepted prefix may publish partial output.""" 2 import os, pathlib, subprocess, sys, json 3 root=pathlib.Path(__file__).resolve().parents[1];os.chdir(root) 4 seed=os.environ.get('OMEGA_SEED','build/bootstrap/omc') 5 data=pathlib.Path('tests/fixtures/order_calls.om').read_bytes() 6 # All byte prefixes include mid-token, mid-number and unterminated blocks. 7 cases=[data[:i] for i in range(len(data)+1)] 8 cases += [b'C',b'\x00',b'\xff',b'fn main to int\nret '+b'neg '*1025+b'int 1\nend\n',b'note '+b'x'*65536+b'\nfn main to int\nret 0\nend\n'] 9 count=0;refused=0;accepted=0 10 for src in cases: 11 path=pathlib.Path('build/adversarial.om');path.write_bytes(src) 12 native=subprocess.run([seed],input=src,capture_output=True,timeout=5) 13 assert native.returncode>=0 and native.returncode<100, native.returncode 14 for t in ('c','python'): 15 p=(subprocess.run(['build/toc'],input=src,capture_output=True,timeout=5) if '--baseline' in sys.argv else subprocess.run(['tools/bridge',t,str(path)],capture_output=True,timeout=5)) 16 assert 0<=p.returncode<100,(t,p.returncode,p.stderr) 17 if native.returncode: 18 assert p.returncode==native.returncode and not p.stdout,(t,p.returncode,native.returncode) 19 elif p.returncode: 20 assert not p.stdout and b'error ' in p.stderr 21 else: 22 assert p.stdout 23 refused+=int(p.returncode!=0);accepted+=int(p.returncode==0) 24 count+=1 25 print(f'robustness cases={count} target_accepts={accepted} target_refusals={refused} failures=0 RC=0')