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/delegate-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 / delegate-test.om` 184 lines ยท 3087 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 global checks ulong 1 3 global fails ulong 1 4 global report uchar 64 5 text title "delegate checks=" 6 fn check got ulong want ulong to void 7 put checks 0 add get checks 0 1 8 if ne got want 9 put fails 0 add get fails 0 1 10 end 11 end 12 fn parent p edit ulong 24 to void 13 for i ulong 24 14 put p i 0 15 end 16 put p 0 1 17 put p 1 7 18 put p 2 1024 19 put p 3 200 20 put p 4 100 21 put p 5 4 22 for i ulong 16 23 put p add i 8 add i 100 24 end 25 end 26 fn child c edit ulong 24 to void 27 parent c 28 put c 1 3 29 put c 2 512 30 put c 3 100 31 put c 4 90 32 put c 5 3 33 put c 16 200 34 put c 20 300 35 end 36 fn summary to int 37 for i ulong len title 38 put report i get title i 39 end 40 n = get checks 0 41 at = len title 42 put report at uchar add 48 div n 100 43 put report add at 1 uchar add 48 rem div n 10 10 44 put report add at 2 uchar add 48 rem n 10 45 put report add at 3 32 46 put report add at 4 uchar add 48 div get fails 0 100 47 put report add at 5 uchar add 48 rem div get fails 0 10 10 48 put report add at 6 uchar add 48 rem get fails 0 10 49 put report add at 7 10 50 w = write 1 report 0 add at 8 51 if ne w long add at 8 52 ret 2 53 end 54 if ne get fails 0 0 55 ret 1 56 end 57 ret 0 58 end 59 fn main to int 60 p = new ulong 24 0 61 c = new ulong 24 0 62 parent p 63 child c 64 check capchild p c 50 0 65 put c 1 8 66 check capchild p c 50 66 67 child c 68 put c 2 1025 69 check capchild p c 50 67 70 child c 71 put c 3 201 72 check capchild p c 50 68 73 child c 74 put c 4 101 75 check capchild p c 50 69 76 child c 77 put c 5 4 78 check capchild p c 50 73 79 child c 80 put p 5 0 81 check capchild p c 50 72 82 parent p 83 child c 84 put c 4 50 85 check capchild p c 50 65 86 child c 87 check capchild p c 100 64 88 child c 89 put c 1 0 90 put c 2 0 91 put c 3 0 92 put c 5 0 93 check capchild p c 50 0 94 put p 1 0 95 put p 2 0 96 put p 3 0 97 check capchild p c 50 0 98 put c 1 1 99 check capchild p c 50 66 100 101 for i ulong 8 102 parent p 103 child c 104 put c add i 8 add get c add i 8 1 105 check capchild p c 50 add 70 div i 4 106 end 107 parent p 108 child c 109 for i ulong 4 110 put c add i 16 get p add i 16 111 end 112 check capchild p c 50 74 113 child c 114 for i ulong 4 115 put c add i 20 get p add i 20 116 end 117 check capchild p c 50 75 118 for group ulong 4 119 parent p 120 child c 121 for j ulong 4 122 put p add 8 add mul group 4 j 0 123 end 124 check capchild p c 50 62 125 parent p 126 for j ulong 4 127 put c add 8 add mul group 4 j 0 128 end 129 check capchild p c 50 62 130 end 131 132 parent p 133 child c 134 put p 0 2 135 check capchild p c 50 61 136 parent p 137 put c 0 2 138 check capchild p c 50 61 139 child c 140 put c 1 512 141 check capchild p c 50 66 142 child c 143 put c 6 1 144 check capchild p c 50 62 145 child c 146 put c 7 1 147 check capchild p c 50 62 148 child c 149 put c 5 `18446744073709551615` 150 check capchild p c 50 62 151 child c 152 put p 5 65 153 check capchild p c 50 62 154 parent p 155 child c 156 put p 5 1 157 put c 5 0 158 check capchild p c 50 0 159 put p 2 `18446744073709551615` 160 put c 2 `18446744073709551615` 161 check capchild p c 50 0 162 put p 2 `18446744073709551614` 163 check capchild p c 50 67 164 parent p 165 child c 166 put p 1 `9223372036854775808` 167 put c 1 `9223372036854775808` 168 check capchild p c 50 0 169 put c 1 `9223372036854775809` 170 check capchild p c 50 66 171 172 note Exhaust all subsets of the small rights profile, not only one happy case. 173 for rights ulong 32 174 parent p 175 child c 176 put c 1 rights 177 want = ulong 66 178 if lt rights 8 179 want = 0 180 end 181 check capchild p c 50 want 182 end 183 ret summary 184 end