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 / core / rsi / tests / reuse-eval / stats-decide.om

287 lines · 4442 bytes Raw Blame History
1note units: stats
2note SPDX-License-Identifier: Apache-2.0
3note stats-decide: the contract 10 decision (with K7 control outcomes) as a truth table over the
4note globals stdecide reads. Every STOP, GO and INVESTIGATE branch and the boundary values
5note (ppm 999999 versus 1000000, coverage exactly one half, no transfer QUERY) are covered, plus
6note a missing (control, sub-case) pair (not run), K17 failed processes (END failure, nonzero
7note exit: wrong refusal, STOP; echo is not scored) and the controls.log record checks
8note (unknown sub-case and repeated pair refused with code 13).
9note Return value of stdecide: 1 GO, 2 INVESTIGATE, 3 STOP; STDEC 1 holds the reason bits.
10note Exit 0 = pass; otherwise the failing case number.
11
12note the GO state: every bound below 1, coverage 5 of 10, C1..C11 detected, C12 reported, every
13note required sub-case present
14fn tdbase to void
15streset
16for s ulong 13
17put STLO s 500000
18put STHI s 500000
19end
20stcadd 4 17 10
21stcadd 4 18 5
22for c ulong 14
23b = mul add c 1 8
24put STCT b 1
25put STCT add b 6 stcreq add c 1
26if eq c 13
27put STCT add b 3 1
28else
29put STCT add b 1 1
30end
31end
32end
33
34note controls.log record k in STFB: control c, sub-case s, outcome o
35fn tdrec k ulong c ulong s ulong o ulong to void
36v = new ulong 8 0
37put v 0 c
38put v 1 s
39put v 2 o
40for w ulong 8
41tdword add mul k 64 mul w 8 get v w
42end
43end
44
45note one little-endian word at byte p of STFB
46fn tdword p ulong x ulong to void
47for b ulong 8
48put STFB add p b uchar and shr x mul b 8 255
49end
50end
51
52note stctl1 on record 0 = (c, s, 1) after streset; returns STRF 2 when refused (13), 9 when
53note accepted, 99 on another code
54fn tdone c ulong s ulong to ulong
55streset
56tdrec 0 c s 1
57e = stctl1 0
58if eq e 0
59ret 9
60end
61if ne e 13
62ret 99
63end
64ret get STRF 2
65end
66
67note the 36 (control, sub-case) pairs of EvalJudge's controls run (controls-dev2/controls.log,
68note confirmed by EvalJudge), written here independently of stcreq as control*10 + sub-case
69text TDL "10 11 20 21 30 40 41 50 51 60 70 71 72 73 74 75 80 81 82 90 91 101 102 103 104 105 106 107 108 109 110 111 120 121 130 140 "
70
71note every listed pair is accepted, no pair is missing, and there are exactly 36
72fn tdlist to int
73streset
74k = ulong 0
75v = ulong 0
76for i ulong len TDL
77c = get TDL i
78if eq c 32
79tdrec k div v 10 rem v 10 1
80k = add k 1
81v = 0
82else
83v = add mul v 10 ulong sub c 48
84end
85end
86if ne k 36
87ret 50
88end
89for j ulong k
90if ne stctl1 j 0
91ret 51
92end
93end
94for c ulong 14
95if ne stcmiss add c 1 0
96ret 52
97end
98end
99ret 0
100end
101
102fn tdctl to int
103if ne tdone 3 1 2
104ret 30
105end
106if ne tdone 10 0 2
107ret 31
108end
109if ne tdone 10 10 2
110ret 32
111end
112if ne tdone 7 5 9
113ret 33
114end
115if ne tdone 10 9 9
116ret 34
117end
118streset
119tdrec 0 8 2 1
120tdrec 1 8 2 1
121if ne stctl1 0 0
122ret 35
123end
124if or ne stctl1 1 13 ne get STRF 2 3
125ret 36
126end
127if ne stcmiss 8 2
128ret 37
129end
130if ne stcout 8 3
131ret 38
132end
133ret 0
134end
135
136fn tdk17 to int
137tdbase
138stpexit 4 1024
139if not tdis 3 2
140ret 41
141end
142if or ne stc 4 27 1 ne stc 4 28 1
143ret 42
144end
145tdbase
146stpexit 7 1
147if or not tdis 3 2 ne stc 7 27 0
148ret 43
149end
150tdbase
151stpexit 2 0
152if or not tdis 1 0 ne stc 2 28 0
153ret 44
154end
155tdbase
156stpexit 0 9
157if or not tdis 1 0 ne stc 0 28 1
158ret 45
159end
160ret 0
161end
162
163fn tdis d ulong bits ulong to bool
164r = stdecide
165if ne r d
166ret false
167end
168ret eq get STDEC 1 bits
169end
170
171fn main to int
172tdbase
173if not tdis 1 0
174ret 1
175end
176tdbase
177stcadd 7 1 1
178if not tdis 3 1
179ret 2
180end
181tdbase
182stcadd 0 1 1
183if not tdis 1 0
184ret 3
185end
186tdbase
187stcadd 1 3 1
188if not tdis 3 2
189ret 4
190end
191tdbase
192put STCT 34 1
193if not tdis 3 4
194ret 5
195end
196tdbase
197put STCT 69 1
198if not tdis 3 8
199ret 6
200end
201tdbase
202put STLO 4 1000000
203put STHI 4 1000000
204if not tdis 3 48
205ret 7
206end
207tdbase
208put STLO 4 999999
209put STHI 4 1000000
210if not tdis 2 32
211ret 8
212end
213tdbase
214put STHI 4 999999
215if not tdis 1 0
216ret 9
217end
218tdbase
219put STHI 8 1000000
220if not tdis 2 64
221ret 10
222end
223tdbase
224put STHI 9 1000000
225if not tdis 2 128
226ret 11
227end
228tdbase
229put STCNT 146 4
230if not tdis 2 256
231ret 12
232end
233tdbase
234put STCNT 145 0
235put STCNT 146 0
236if not tdis 2 256
237ret 13
238end
239tdbase
240put STCT 44 1
241if not tdis 2 512
242ret 14
243end
244tdbase
245put STCT 48 0
246put STCT 49 0
247if not tdis 2 512
248ret 15
249end
250tdbase
251stcadd 5 1 1
252put STCT 44 1
253if not tdis 3 513
254ret 16
255end
256tdbase
257put STCT 115 0
258put STCT 113 1
259if not tdis 1 0
260ret 17
261end
262tdbase
263put STHI 10 1000000
264put STLO 10 1000000
265put STHI 11 1000000
266put STHI 12 1000000
267if not tdis 1 0
268ret 18
269end
270tdbase
271put STCT 86 1020
272if not tdis 2 512
273ret 19
274end
275if ne stcmiss 10 1
276ret 20
277end
278r = tdctl
279if ne r 0
280ret r
281end
282r = tdlist
283if ne r 0
284ret r
285end
286ret tdk17
287end