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/train/omega-llm/tools/combined/test.sh # 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 / train / omega-llm / tools / combined / test.sh` 134 lines ยท 4773 bytes Raw Blame History 1 #!/bin/sh 2 # Synthetic routing tests. The real symbolic engines and compiler execute every checked case. 3 set -eu 4 umask 077 5 [ "$#" = 1 ] || { echo 'usage: test.sh BUILT_KIT' >&2; exit 2; } 6 installed=$(CDPATH= cd -- "$1" && pwd) 7 d=$(mktemp -d) 8 trap 'rm -rf -- "$d"' EXIT 9 trap 'exit 1' HUP INT TERM 10 cd "$d" 11 mkdir kit 12 for name in solve combined omc om_formalize om_sketch om_synth; do 13 ln -s "$installed/$name" "kit/$name" 14 done 15 touch kit/r6.ck kit/r3.ck kit/base.ck kit/trace.ck kit/merges.bin kit/S2_fold.sp 16 cat > kit/ollm <<'MOCK' 17 #!/bin/sh 18 set -eu 19 REPLAY=$(dirname -- "$0")/../replay 20 test -f "$2" 21 name=$(basename "$2") 22 case "$1" in 23 sample) 24 test "$#" = 7 && test "$3/$4/$5" = "42/128/0" && test -s "$REPLAY/$name" && test -f "$7" || exit 2 25 cat "$REPLAY/$name";; 26 spsamp) 27 test "$#" = 8 && test "$4/$5" = "64/700" && test "$name" = r3.ck && test -f "$3" && test -f "$8" || exit 2 28 cat "$REPLAY/strand-$7";; 29 *) exit 2;; 30 esac 31 MOCK 32 chmod 700 kit/ollm 33 mkdir replay 34 for ck in r6.ck r3.ck base.ck trace.ck; do printf 'ret 0\nend\n' > "replay/$ck"; done 35 for s in 1100 1101 1102 1103; do cp replay/r6.ck "replay/strand-$s"; done 36 prompt() { printf 'note %s\nfn solve %s\n' "$1" "$2" > prompt; } 37 answer() { kit/solve "$@" > got 2> route; } 38 route_is() { grep -Fx "route $1" route >/dev/null; } 39 refuse() { 40 rc=0 41 kit/solve "$@" > got 2> route || rc=$? 42 [ "$rc" = "$want" ] && [ ! -s got ] || { echo "expected $want, got $rc" >&2; exit 1; } 43 } 44 prompt 'return the argument rounded down to a multiple of 14' 'a ulong to ulong' 45 answer prompt 46 route_is om_synth 47 printf '41 28\n70 70\n0 0\n13 0\n' > examples 48 answer prompt examples 49 route_is om_synth 50 prompt 'demo operation' 'a ulong b ulong to ulong' 51 printf '2 3 5\n7 11 18\n5 0 5\n21 3 24\n' > examples 52 answer prompt examples 53 grep -Eq '^route om_(sketch|synth)$' route 54 prompt 'demo operation' 'a view ulong 8 n ulong to ulong' 55 printf '4 1 3 9 4 0 0 0 0 17\n2 1 1 7 2 0 0 0 0 2\n' > examples 56 answer prompt examples 57 route_is om_sketch 58 # Historical r-030, including tails after the active length. 59 prompt 'return the sum of the items at even indexes minus the sum of the items at odd indexes among the first n items, or zero when the odd sum is larger' 'a view ulong 8 n ulong to ulong' 60 cat > examples <<'ROWS' 61 0 7 0 3 11 3 2 9 13 0 62 2 7 0 3 11 3 2 9 13 7 63 5 7 0 3 11 3 2 9 13 2 64 8 7 0 3 11 3 2 9 13 0 65 0 9 2 3 2 1 12 0 9 0 66 2 9 2 3 2 1 12 0 9 7 67 5 9 2 3 2 1 12 0 9 9 68 8 9 2 3 2 1 12 0 9 0 69 ROWS 70 answer prompt examples 71 route_is om_sketch 72 prompt 'demo operation' 'a edit ulong 8 n ulong to void' 73 printf '2 1 3 0 0 0 0 0 0 3 1 0 0 0 0 0 0\n3 7 5 9 0 0 0 0 0 9 5 7 0 0 0 0 0\n' > examples 74 answer prompt examples 75 route_is om_sketch 76 prompt 'demo operation' 'a ulong to ulong' 77 answer prompt 78 route_is r6.ck 79 cmp got replay/r6.ck 80 # Nine cases force checking beyond the eight lanes used to propose a symbolic program. 81 n=1 82 : > examples 83 while [ "$n" -le 9 ]; do 84 expected=$((n * 937 + 417)) 85 printf '%s %s\n' "$n" "$expected" >> examples 86 n=$((n + 1)) 87 done 88 printf 'if eq a 9\nret 0\nend\nret add mul a 937 417\nend\n' > replay/r6.ck 89 printf 'ret add mul a 937 417\nend\n' > good 90 cp good replay/trace.ck 91 answer prompt examples 92 route_is trace.ck 93 cmp good got 94 cp replay/base.ck replay/trace.ck 95 cp good replay/strand-1102 96 answer prompt examples 97 route_is S2_fold.sp 98 cmp good got 99 cp replay/base.ck replay/strand-1102 100 want=1 101 refuse prompt examples 102 # Every candidate below would satisfy all nine rows if its invalid line were ignored. 103 for local in se so runningTotal local_with_underscores; do 104 printf '%s = mul a 937\nret add %s 417\nend\n' "$local" "$local" > replay/r3.ck 105 answer prompt examples 106 route_is r3.ck 107 cmp got replay/r3.ck 108 done 109 printf 'subtotal = ulong 0\nfor position ulong a bound 9\nsubtotal = add subtotal 937\nend\nret add subtotal 417\nend\n' > replay/r3.ck 110 answer prompt examples 111 route_is r3.ck 112 cmp got replay/r3.ck 113 for body in 'ret add mul missing 937 417' 'ret add mul z 937 417' 'for add ulong 0' 'for note ulong 0' 'for getpid ulong 0'; do 114 { printf '%s\n' "$body"; case "$body" in 'for '*) printf 'end\n';; esac; cat good; } > replay/r3.ck 115 refuse prompt examples 116 done 117 { printf 'unused = getpid\n'; cat good; } > replay/r3.ck 118 refuse prompt examples 119 { cat good; printf 'fn extra to int\nret 0\nend\n'; } > replay/r3.ck 120 refuse prompt examples 121 printf '`18446744073709551616` 2\n' > invalid 122 want=65 123 refuse prompt invalid 124 : > invalid 125 refuse prompt invalid 126 printf 'note demo\nfn solve a ulong to ulong\nend\n' > invalid-prompt 127 refuse invalid-prompt 128 printf '9 0 0 0 0 0 0 0 0 0\n' > invalid 129 prompt 'demo' 'a view ulong 8 n ulong to ulong' 130 refuse prompt invalid 131 rm kit/om_formalize 132 want=70 133 refuse prompt 134 echo 'PASS symbolic, checked scalar and array, neural fallback, trace, specialist, rejection, setup error'