interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / seed / omc / contracts / parity-check.om

59 lines · 1207 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0
2note Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3note
4note Pure seeded OM-2 contract parity harness for seed/omc/contracts/parity.om.
5note Replaces the retired C runner.c parity step in seed/host/check.sh after
6note commit bb7f2dd68 removed src/compiler/.
7note
8note Composed after seed/omc/contracts/parity.om (stripping its leading om2 line):
9note forks a child per input from parity.inputs (-1, 0, 1, 9, 10, 11, 20) and
10note verifies exact return values (0, 1, 9, 10) and contract traps (9 -> exit 109,
11note 10 -> exit 110).
12
13global g_wstat uchar 16
14
15fn run_one x int to int
16 pid = fork
17 if lt pid 0
18 ret neg int 1
19 end
20 if eq pid 0
21 v = check x
22 exit v
23 end
24 r = waitpid int pid g_wstat 0 4 0
25 if lt r 0
26 ret neg int 1
27 end
28 lo = ulong get g_wstat 0
29 hi = ulong get g_wstat 1
30 if ne and lo 127 0
31 ret neg int 2
32 end
33 ret int hi
34end
35
36fn main to int
37 if ne run_one neg int 1 109
38 ret 1
39 end
40 if ne run_one 0 0
41 ret 2
42 end
43 if ne run_one 1 1
44 ret 3
45 end
46 if ne run_one 9 9
47 ret 4
48 end
49 if ne run_one 10 10
50 ret 5
51 end
52 if ne run_one 11 110
53 ret 6
54 end
55 if ne run_one 20 110
56 ret 7
57 end
58 ret 0
59end