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/si/rosetta/exercises/pascals-triangle/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 / si / rosetta / exercises / pascals-triangle / test.om` 245 lines ยท 4039 bytes Raw Blame History 1 note ---- test harness (appended after the solution by exercise.sh) ---- 2 text tok "ok " 3 text tnok "not ok " 4 text tsep " - " 5 text tnl "\n" 6 global tfails ulong 1 7 global tnum ulong 1 8 fn temit a view uchar * to void 9 o = ulong 0 10 while lt o len a bound 4096 11 k = write 1 a o sub len a o 12 if le k 0 13 exit 2 14 end 15 o = add o ulong k 16 end 17 end 18 fn temitu n ulong to void 19 d = new uchar 20 0 20 i = ulong 20 21 v = n 22 while true bound 20 23 i = sub i 1 24 put d i uchar add rem v 10 48 25 v = div v 10 26 if eq v 0 27 break 28 end 29 end 30 temit part d i sub 20 i 31 end 32 note one TAP-style line per case; main returns the number of failed cases 33 fn tcheck c bool what view uchar * to void 34 put tnum 0 add get tnum 0 1 35 if c 36 temit tok 37 else 38 temit tnok 39 put tfails 0 add get tfails 0 1 40 end 41 temitu get tnum 0 42 temit tsep 43 temit what 44 temit tnl 45 end 46 note cases: exercism/problem-specifications exercises/pascals-triangle/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 8 cases kept, 0 skipped 50 fn tueq a view ulong * b view ulong * to bool 51 if ne len a len b 52 ret false 53 end 54 for i ulong len a 55 if ne get a i get b i 56 ret false 57 end 58 end 59 ret true 60 end 61 text c0 "rows: zero rows" 62 text c1 "rows: single row" 63 text c2 "rows: two rows" 64 text c3 "rows: three rows" 65 text c4 "rows: four rows" 66 text c5 "rows: five rows" 67 text c6 "rows: six rows" 68 text c7 "rows: ten rows" 69 note canonical case `9920ce55`-9629-46d5-85d6-`4201f4a4234d` 70 fn tc0 to bool 71 o = new ulong 256 0 72 n = rows 0 o 73 ret eq n 0 74 end 75 note canonical case `70d643ce`-a46d-4e93-af58-`12d88dd01f21` 76 fn tc1 to bool 77 o = new ulong 256 0 78 n = rows 1 o 79 a0 = new ulong 1 0 80 put a0 0 1 81 ret tueq part o 0 n a0 82 end 83 note canonical case `a6e5a2a2`-fc9a-4b47-9f4f-`ed9ad9fbe4bd` 84 fn tc2 to bool 85 o = new ulong 256 0 86 n = rows 2 o 87 a0 = new ulong 3 0 88 put a0 0 1 89 put a0 1 1 90 put a0 2 1 91 ret tueq part o 0 n a0 92 end 93 note canonical case `97206a99`-79ba-4b04-b1c5-`3c0fa1e16925` 94 fn tc3 to bool 95 o = new ulong 256 0 96 n = rows 3 o 97 a0 = new ulong 6 0 98 put a0 0 1 99 put a0 1 1 100 put a0 2 1 101 put a0 3 1 102 put a0 4 2 103 put a0 5 1 104 ret tueq part o 0 n a0 105 end 106 note canonical case `565a0431`-c797-417c-a2c8-`2935e01ce306` 107 fn tc4 to bool 108 o = new ulong 256 0 109 n = rows 4 o 110 a0 = new ulong 10 0 111 put a0 0 1 112 put a0 1 1 113 put a0 2 1 114 put a0 3 1 115 put a0 4 2 116 put a0 5 1 117 put a0 6 1 118 put a0 7 3 119 put a0 8 3 120 put a0 9 1 121 ret tueq part o 0 n a0 122 end 123 note canonical case `06f9ea50`-9f51-4eb2-b9a9-`c00975686c27` 124 fn tc5 to bool 125 o = new ulong 256 0 126 n = rows 5 o 127 a0 = new ulong 15 0 128 put a0 0 1 129 put a0 1 1 130 put a0 2 1 131 put a0 3 1 132 put a0 4 2 133 put a0 5 1 134 put a0 6 1 135 put a0 7 3 136 put a0 8 3 137 put a0 9 1 138 put a0 10 1 139 put a0 11 4 140 put a0 12 6 141 put a0 13 4 142 put a0 14 1 143 ret tueq part o 0 n a0 144 end 145 note canonical case `c3912965`-ddb4-46a9-848e-`3363e6b00b13` 146 fn tc6 to bool 147 o = new ulong 256 0 148 n = rows 6 o 149 a0 = new ulong 21 0 150 put a0 0 1 151 put a0 1 1 152 put a0 2 1 153 put a0 3 1 154 put a0 4 2 155 put a0 5 1 156 put a0 6 1 157 put a0 7 3 158 put a0 8 3 159 put a0 9 1 160 put a0 10 1 161 put a0 11 4 162 put a0 12 6 163 put a0 13 4 164 put a0 14 1 165 put a0 15 1 166 put a0 16 5 167 put a0 17 10 168 put a0 18 10 169 put a0 19 5 170 put a0 20 1 171 ret tueq part o 0 n a0 172 end 173 note canonical case `6cb26c66`-7b57-4161-962c-`81ec8c99f16b` 174 fn tc7 to bool 175 o = new ulong 256 0 176 n = rows 10 o 177 a0 = new ulong 55 0 178 put a0 0 1 179 put a0 1 1 180 put a0 2 1 181 put a0 3 1 182 put a0 4 2 183 put a0 5 1 184 put a0 6 1 185 put a0 7 3 186 put a0 8 3 187 put a0 9 1 188 put a0 10 1 189 put a0 11 4 190 put a0 12 6 191 put a0 13 4 192 put a0 14 1 193 put a0 15 1 194 put a0 16 5 195 put a0 17 10 196 put a0 18 10 197 put a0 19 5 198 put a0 20 1 199 put a0 21 1 200 put a0 22 6 201 put a0 23 15 202 put a0 24 20 203 put a0 25 15 204 put a0 26 6 205 put a0 27 1 206 put a0 28 1 207 put a0 29 7 208 put a0 30 21 209 put a0 31 35 210 put a0 32 35 211 put a0 33 21 212 put a0 34 7 213 put a0 35 1 214 put a0 36 1 215 put a0 37 8 216 put a0 38 28 217 put a0 39 56 218 put a0 40 70 219 put a0 41 56 220 put a0 42 28 221 put a0 43 8 222 put a0 44 1 223 put a0 45 1 224 put a0 46 9 225 put a0 47 36 226 put a0 48 84 227 put a0 49 126 228 put a0 50 126 229 put a0 51 84 230 put a0 52 36 231 put a0 53 9 232 put a0 54 1 233 ret tueq part o 0 n a0 234 end 235 fn main to int 236 tcheck tc0 c0 237 tcheck tc1 c1 238 tcheck tc2 c2 239 tcheck tc3 c3 240 tcheck tc4 c4 241 tcheck tc5 c5 242 tcheck tc6 c6 243 tcheck tc7 c7 244 ret int get tfails 0 245 end