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
omega-mv / aienux / allen / tests / edges.om
| 1 | note Boundary and recovery gates. Test input construction is handwritten Omega. |
| 2 | fn rt_edges to void |
| 3 | reset |
| 4 | put R 0 100 |
| 5 | put Inlen 0 159 |
| 6 | for i ulong 159 |
| 7 | put In i uchar 120 |
| 8 | end |
| 9 | check start 1 0 1201 |
| 10 | check eq get R 7 159 1202 |
| 11 | cancel |
| 12 | put Inlen 0 160 |
| 13 | check not start 1 0 1203 |
| 14 | check eq get R 0 101 1204 |
| 15 | put Inlen 0 1 |
| 16 | put In 0 uchar 9 |
| 17 | check not start 1 0 1205 |
| 18 | check eq classify 0 1206 |
| 19 | put In 0 uchar 120 |
| 20 | check start 1 10 1207 |
| 21 | check heard get R 0 25000 1208 |
| 22 | check eq tick 30010 1 1209 |
| 23 | check eq get R 1 1 1210 |
| 24 | check eq tick 54999 0 1211 |
| 25 | check eq tick 55000 2 1212 |
| 26 | check not heard get R 0 55001 1213 |
| 27 | check restore 1214 |
| 28 | for i ulong 40 |
| 29 | check restore add 1220 i |
| 30 | end |
| 31 | check eq get R 9 32 1260 |
| 32 | check eq get Hlen 31 1 1261 |
| 33 | check eq get Hist 4960 120 1262 |
| 34 | end |
| 35 | fn codeinput part ulong total ulong bytes ulong crcval ulong count ulong to void |
| 36 | outreset |
| 37 | emitb 67 |
| 38 | emitb 79 |
| 39 | emitb 68 |
| 40 | emitb 69 |
| 41 | emitb 32 |
| 42 | emitn 1 |
| 43 | emitb 32 |
| 44 | emitn part |
| 45 | emitb 47 |
| 46 | emitn total |
| 47 | emitb 32 |
| 48 | emitn bytes |
| 49 | emitb 32 |
| 50 | for i ulong 8 |
| 51 | emitb get Digits and shr crcval mul sub 7 i 4 15 |
| 52 | end |
| 53 | emitb 32 |
| 54 | emitb 45 |
| 55 | emitb 32 |
| 56 | for i ulong count |
| 57 | emitb 120 |
| 58 | end |
| 59 | put Inlen 0 get Outlen 0 |
| 60 | for i ulong get Outlen 0 |
| 61 | put In i get Outb i |
| 62 | end |
| 63 | end |
| 64 | fn code_edges to void |
| 65 | codebeg 1 |
| 66 | codeinput 1 1 128 0 127 |
| 67 | check not codetake 1301 |
| 68 | check eq get C 4 0 1302 |
| 69 | codeinput 1 1 128 0 129 |
| 70 | check not codetake 1303 |
| 71 | codeinput 0 1 128 0 128 |
| 72 | check not codetake 1304 |
| 73 | codeinput 1 257 32769 0 128 |
| 74 | check not codetake 1305 |
| 75 | check eq get C 1 0 1306 |
| 76 | for i ulong 256 |
| 77 | codeinput add i 1 256 32768 3124632513 128 |
| 78 | check codetake add 1310 i |
| 79 | end |
| 80 | check eq get C 4 256 1570 |
| 81 | check eq missing 0 1571 |
| 82 | check eq codestat 2 1572 |
| 83 | put C 3 0 |
| 84 | check eq codestat 3 1575 |
| 85 | put C 3 3124632513 |
| 86 | check eq codestat 2 1573 |
| 87 | put R 0 1 |
| 88 | put R 1 1 |
| 89 | cancel |
| 90 | check not codeshow 1 1574 |
| 91 | end |
| 92 | fn lineinput part ulong bytes ulong to void |
| 93 | put Inlen 0 bytes |
| 94 | for i ulong bytes |
| 95 | put In i uchar 120 |
| 96 | end |
| 97 | b = packet 2 1 part 0 0 |
| 98 | put Inlen 0 get Outlen 0 |
| 99 | for i ulong get Outlen 0 |
| 100 | put In i get Outb i |
| 101 | end |
| 102 | end |
| 103 | fn q_edges to void |
| 104 | qbegin 1 1 |
| 105 | for i ulong 8 |
| 106 | lineinput add i 1 1 |
| 107 | check eq qreceive 1 add 1600 i |
| 108 | end |
| 109 | lineinput 9 1 |
| 110 | check eq qreceive 0 1610 |
| 111 | check eq get Q 4 8 1611 |
| 112 | check qtake 1612 |
| 113 | lineinput 9 1 |
| 114 | check eq qreceive 1 1613 |
| 115 | check eq get Q 4 8 1614 |
| 116 | lineinput 10 320 |
| 117 | check eq qreceive 0 1615 |
| 118 | check eq get Q 2 9 1616 |
| 119 | put Inlen 0 1001 |
| 120 | check not packet 1 1 1 1 1001 1617 |
| 121 | end |
| 122 | fn mem_edges to void |
| 123 | for i ulong 3692 |
| 124 | put Mem i 0 |
| 125 | end |
| 126 | mset32 32 32 |
| 127 | mset32 36 512 |
| 128 | for i ulong 32 |
| 129 | off = add 40 mul i 113 |
| 130 | put Mem off uchar 107 |
| 131 | put Mem add off 48 uchar 118 |
| 132 | end |
| 133 | check memenc 10 1701 |
| 134 | check eq get32 12 3692 1702 |
| 135 | check memdec 1703 |
| 136 | mset32 32 33 |
| 137 | check not memenc 11 1704 |
| 138 | check eq get Enc 16 10 1705 |
| 139 | mset32 32 32 |
| 140 | mset32 36 513 |
| 141 | check not memenc 11 1706 |
| 142 | mset32 36 512 |
| 143 | check memenc 11 1707 |
| 144 | put Unit 4095 uchar 1 |
| 145 | check not memdec 1708 |
| 146 | check eq get Md 0 10 1709 |
| 147 | check not txflush true 1710 |
| 148 | check not txread true 1711 |
| 149 | end |
| 150 | fn main to int |
| 151 | constants |
| 152 | rt_edges |
| 153 | code_edges |
| 154 | q_edges |
| 155 | mem_edges |
| 156 | ret int get Fails 0 |
| 157 | end |