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 / seed / qualification / om2 / selftest / cat-bad.om
| 1 | note Harness self-test program (deliberately wrong): copy standard input to standard output, but |
| 2 | note add 1 (wrapping) to the byte at offset 5. The gate must report FAIL, stdout differs at byte 5. |
| 3 | fn main to int |
| 4 | b = new uchar 4096 0 |
| 5 | pos = ulong 0 |
| 6 | go = true |
| 7 | while go |
| 8 | r = read 0 b 0 4096 |
| 9 | if lt r 0 |
| 10 | ret 91 |
| 11 | end |
| 12 | if eq r 0 |
| 13 | go = false |
| 14 | else |
| 15 | n = ulong r |
| 16 | if and le pos 5 lt 5 add pos n |
| 17 | put b sub 5 pos add get b sub 5 pos 1 |
| 18 | end |
| 19 | pos = add pos n |
| 20 | w = write 1 b 0 n |
| 21 | if ne w r |
| 22 | ret 92 |
| 23 | end |
| 24 | end |
| 25 | end |
| 26 | ret 0 |
| 27 | end |