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/seed/authority/action-test.om # 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 / seed / authority / action-test.om` 237 lines ยท 4180 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Tests call the production transition functions. Provider/store I/O is not simulated as durable. 3 global checks ulong 1 4 global fails ulong 1 5 global report uchar 64 6 text title "action checks=" 7 8 fn check got ulong want ulong to void 9 put checks 0 add get checks 0 1 10 if ne got want 11 put fails 0 add get fails 0 1 12 end 13 end 14 15 fn plan r edit ulong 32 to void 16 for i ulong 32 17 put r i 0 18 end 19 put r 0 1 20 put r 1 1 21 put r 3 3 22 put r 4 7 23 put r 5 9 24 put r 6 100 25 for i ulong 24 26 put r add i 8 add i 100 27 end 28 end 29 30 fn context c edit ulong 32 to void 31 for i ulong 32 32 put c i 0 33 end 34 put c 0 1 35 put c 1 1 36 put c 2 50 37 put c 4 7 38 put c 5 9 39 for i ulong 24 40 put c add i 8 add i 100 41 end 42 end 43 44 fn receipt s edit ulong 32 n ulong outcome ulong to void 45 context s 46 put s 1 outcome 47 put s 2 n 48 put s 3 1 49 end 50 51 fn summary to int 52 for i ulong len title 53 put report i get title i 54 end 55 n = get checks 0 56 at = len title 57 put report at uchar add 48 div n 100 58 put report add at 1 uchar add 48 rem div n 10 10 59 put report add at 2 uchar add 48 rem n 10 60 put report add at 3 32 61 put report add at 4 uchar add 48 div get fails 0 100 62 put report add at 5 uchar add 48 rem div get fails 0 10 10 63 put report add at 6 uchar add 48 rem get fails 0 10 64 put report add at 7 10 65 w = write 1 report 0 add at 8 66 if ne w long add at 8 67 ret 2 68 end 69 if ne get fails 0 0 70 ret 1 71 end 72 ret 0 73 end 74 75 fn main to int 76 r = new ulong 32 0 77 c = new ulong 32 0 78 s = new ulong 32 0 79 plan r 80 context c 81 check actstart r c 0 82 check get r 1 2 83 check get r 2 1 84 check actstart r c 20 85 check get r 2 1 86 check actlost r 0 87 check get r 1 3 88 check actlost r 0 89 check actstart r c 21 90 receipt s 1 0 91 check actrecon r s 21 92 check get r 1 3 93 check actstart r c 21 94 receipt s 1 2 95 check actrecon r s 0 96 check get r 1 4 97 check actstart r c 22 98 check actrecon r s 20 99 100 note An observed uncertain outcome also moves an in-flight record to unknown. 101 plan r 102 check actstart r c 0 103 receipt s 1 0 104 check actrecon r s 21 105 check get r 1 3 106 check actstart r c 21 107 108 note Confirmed not performed enables a new attempt only after a fresh admission check. 109 plan r 110 check actstart r c 0 111 check actlost r 0 112 receipt s 1 1 113 check actrecon r s 0 114 check get r 1 1 115 check get r 2 1 116 put c 1 0 117 check actstart r c 30 118 check get r 2 1 119 context c 120 put c 4 8 121 check actstart r c 31 122 context c 123 put c 5 10 124 check actstart r c 32 125 context c 126 put c 2 100 127 check actstart r c 33 128 context c 129 check actstart r c 0 130 check get r 2 2 131 receipt s 1 2 132 check actrecon r s 35 133 check get r 1 2 134 receipt s 2 2 135 check actrecon r s 0 136 check actstart r c 22 137 138 note Every word of every identity is checked before mutating the record. 139 for i ulong 24 140 plan r 141 context c 142 put c add i 8 add get c add i 8 1 143 check actstart r c add 40 div i 4 144 check get r 1 1 145 check get r 2 0 146 end 147 note Receipt binding includes all identities and cannot resolve a different attempt. 148 for i ulong 24 149 plan r 150 context c 151 check actstart r c 0 152 receipt s 1 1 153 put s add i 8 add get s add i 8 1 154 check actrecon r s add 40 div i 4 155 check get r 1 2 156 end 157 158 plan r 159 context c 160 put r 2 3 161 check actstart r c 23 162 put r 2 `18446744073709551615` 163 check actstart r c 12 164 check get r 2 `18446744073709551615` 165 plan r 166 put r 3 0 167 check actstart r c 12 168 plan r 169 put r 3 1025 170 check actstart r c 12 171 plan r 172 put r 7 1 173 check actstart r c 12 174 plan r 175 put r 0 2 176 check actstart r c 11 177 plan r 178 put r 1 99 179 check actstart r c 12 180 plan r 181 put r 1 2 182 check actstart r c 12 183 plan r 184 context c 185 put c 0 2 186 check actstart r c 11 187 context c 188 put c 1 2 189 check actstart r c 30 190 context c 191 put c 3 1 192 check actstart r c 12 193 context c 194 for group ulong 6 195 plan r 196 for j ulong 4 197 put r add 8 add mul group 4 j 0 198 end 199 check actstart r c 12 200 end 201 202 plan r 203 check actstart r c 0 204 receipt s 1 1 205 put s 3 0 206 check actrecon r s 36 207 check get r 1 2 208 receipt s 1 1 209 put s 4 8 210 check actrecon r s 31 211 receipt s 1 1 212 put s 5 10 213 check actrecon r s 32 214 receipt s 1 3 215 check actrecon r s 12 216 receipt s 1 1 217 put s 6 1 218 check actrecon r s 12 219 check actlost r 0 220 check actstart r c 21 221 receipt s 1 1 222 check actrecon r s 0 223 check actlost r 20 224 check get r 1 1 225 226 note Limit is enforced across reconciliation cycles, without rotating operation identity. 227 plan r 228 for i ulong 3 229 check actstart r c 0 230 receipt s add i 1 1 231 check actrecon r s 0 232 end 233 check actstart r c 23 234 check get r 2 3 235 check get r 8 100 236 ret summary 237 end