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/native/control/tests/reuse.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 / native / control / tests / reuse.om` 154 lines ยท 2595 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 global checks ulong 1 3 global fails ulong 1 4 global report uchar 64 5 text title "reuse 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 profile p edit ulong 40 to void 13 for i ulong 40 14 put p i 0 15 end 16 put p 0 1 17 put p 1 1 18 put p 2 32 19 put p 3 4096 20 put p 4 1 21 put p 5 2 22 put p 6 1 23 for i ulong 28 24 put p add i 8 add i 100 25 end 26 end 27 fn saved s edit ulong 40 to void 28 profile s 29 for i ulong 4 30 put s add i 36 add i 200 31 end 32 end 33 fn payload h edit ulong 4 to void 34 for i ulong 4 35 put h i add i 200 36 end 37 end 38 fn summary to int 39 for i ulong len title 40 put report i get title i 41 end 42 n = get checks 0 43 at = len title 44 put report at uchar add 48 div n 100 45 put report add at 1 uchar add 48 rem div n 10 10 46 put report add at 2 uchar add 48 rem n 10 47 put report add at 3 32 48 put report add at 4 uchar add 48 div get fails 0 100 49 put report add at 5 uchar add 48 rem div get fails 0 10 10 50 put report add at 6 uchar add 48 rem get fails 0 10 51 put report add at 7 10 52 w = write 1 report 0 add at 8 53 if ne w long add at 8 54 ret 2 55 end 56 if ne get fails 0 0 57 ret 1 58 end 59 ret 0 60 end 61 fn main to int 62 s = new ulong 40 0 63 w = new ulong 40 0 64 h = new ulong 4 0 65 saved s 66 profile w 67 payload h 68 check kvmatch s w h 0 69 for i ulong 6 70 saved s 71 put s add i 1 add get s add i 1 1 72 check kvmatch s w h add 111 i 73 end 74 for i ulong 28 75 saved s 76 put s add i 8 add get s add i 8 1 77 check kvmatch s w h add 120 div i 4 78 end 79 for i ulong 4 80 saved s 81 payload h 82 put h i add get h i 1 83 check kvmatch s w h 127 84 end 85 payload h 86 for g ulong 7 87 saved s 88 profile w 89 for j ulong 4 90 put s add 8 add mul g 4 j 0 91 end 92 check kvmatch s w h 104 93 saved s 94 for j ulong 4 95 put w add 8 add mul g 4 j 0 96 end 97 check kvmatch s w h 104 98 end 99 profile w 100 saved s 101 put s 0 2 102 check kvmatch s w h 100 103 saved s 104 put w 0 2 105 check kvmatch s w h 100 106 profile w 107 put s 7 1 108 check kvmatch s w h 102 109 saved s 110 put w 7 1 111 check kvmatch s w h 102 112 profile w 113 for i ulong 6 114 saved s 115 put s add i 1 0 116 check kvmatch s w h 103 117 end 118 saved s 119 put s 2 4097 120 check kvmatch s w h 103 121 saved s 122 put s 5 5 123 check kvmatch s w h 103 124 saved s 125 for i ulong 4 126 put s add i 36 0 127 end 128 check kvmatch s w h 104 129 saved s 130 for i ulong 4 131 profile w 132 put w add i 36 1 133 check kvmatch s w h 128 134 end 135 profile w 136 saved s 137 check kvmatch s w h 0 138 note Whole-token prefix identity is required even if lengths match. 139 put w 28 999 140 check kvmatch s w h 125 141 profile w 142 put w 24 999 143 check kvmatch s w h 124 144 profile w 145 put w 16 999 146 check kvmatch s w h 122 147 note A prefix that fills the whole context is admitted. 148 profile w 149 saved s 150 put s 2 4096 151 put w 2 4096 152 check kvmatch s w h 0 153 ret summary 154 end