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-rosetta/blob/main/exercises/protein-translation/test.om # omega-rosetta aien-dev/omega-rosetta Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-rosetta / exercises / protein-translation / test.om` 438 lines ยท 9591 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/protein-translation/canonical-data.json at 47 note commit `650bebeb39ad40439175288042aece982b0a90a9` (2026-10-19), MIT licence, 48 note https://github.com/exercism/problem-specifications 49 note 30 cases kept, 0 skipped, 1 superseded (reimplemented) cases omitted 50 fn tbeq a view uchar * b view uchar * 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 z0 "z" 62 text c1 "proteins: Empty RNA sequence results in no proteins" 63 text s2 "AUG" 64 text e3 "Methionine" 65 text c4 "proteins: Methionine RNA sequence" 66 text s5 "UUU" 67 text e6 "Phenylalanine" 68 text c7 "proteins: Phenylalanine RNA sequence 1" 69 text s8 "UUC" 70 text e9 "Phenylalanine" 71 text c10 "proteins: Phenylalanine RNA sequence 2" 72 text s11 "UUA" 73 text e12 "Leucine" 74 text c13 "proteins: Leucine RNA sequence 1" 75 text s14 "UUG" 76 text e15 "Leucine" 77 text c16 "proteins: Leucine RNA sequence 2" 78 text s17 "UCU" 79 text e18 "Serine" 80 text c19 "proteins: Serine RNA sequence 1" 81 text s20 "UCC" 82 text e21 "Serine" 83 text c22 "proteins: Serine RNA sequence 2" 84 text s23 "UCA" 85 text e24 "Serine" 86 text c25 "proteins: Serine RNA sequence 3" 87 text s26 "UCG" 88 text e27 "Serine" 89 text c28 "proteins: Serine RNA sequence 4" 90 text s29 "UAU" 91 text e30 "Tyrosine" 92 text c31 "proteins: Tyrosine RNA sequence 1" 93 text s32 "UAC" 94 text e33 "Tyrosine" 95 text c34 "proteins: Tyrosine RNA sequence 2" 96 text s35 "UGU" 97 text e36 "Cysteine" 98 text c37 "proteins: Cysteine RNA sequence 1" 99 text s38 "UGC" 100 text e39 "Cysteine" 101 text c40 "proteins: Cysteine RNA sequence 2" 102 text s41 "UGG" 103 text e42 "Tryptophan" 104 text c43 "proteins: Tryptophan RNA sequence" 105 text s44 "UAA" 106 text c45 "proteins: STOP codon RNA sequence 1" 107 text s46 "UAG" 108 text c47 "proteins: STOP codon RNA sequence 2" 109 text s48 "UGA" 110 text c49 "proteins: STOP codon RNA sequence 3" 111 text s50 "UUUUUU" 112 text e51 "Phenylalanine,Phenylalanine" 113 text c52 "proteins: Sequence of two protein codons translates into proteins" 114 text s53 "UUAUUG" 115 text e54 "Leucine,Leucine" 116 text c55 "proteins: Sequence of two different protein codons translates into proteins" 117 text s56 "AUGUUUUGG" 118 text e57 "Methionine,Phenylalanine,Tryptophan" 119 text c58 "proteins: Translate RNA strand into correct protein list" 120 text s59 "UAGUGG" 121 text c60 "proteins: Translation stops if STOP codon at beginning of sequence" 122 text s61 "UGGUAG" 123 text e62 "Tryptophan" 124 text c63 "proteins: Translation stops if STOP codon at end of two-codon sequence" 125 text s64 "AUGUUUUAA" 126 text e65 "Methionine,Phenylalanine" 127 text c66 "proteins: Translation stops if STOP codon at end of three-codon sequence" 128 text s67 "UGGUAGUGG" 129 text e68 "Tryptophan" 130 text c69 "proteins: Translation stops if STOP codon in middle of three-codon sequence" 131 text s70 "UGGUGUUAUUAAUGGUUU" 132 text e71 "Tryptophan,Cysteine,Tyrosine" 133 text c72 "proteins: Translation stops if STOP codon in middle of six-codon sequence" 134 text s73 "AUGAUG" 135 text e74 "Methionine,Methionine" 136 text c75 "proteins: Sequence of two non-STOP codons does not translate to a STOP codon" 137 text s76 "XYZ" 138 text c77 "proteins: Unknown amino acids, not part of a codon, can't translate" 139 text s78 "AUGU" 140 text c79 "proteins: Incomplete RNA sequence can't translate" 141 text s80 "UUCUUCUAAUGGU" 142 text e81 "Phenylalanine,Phenylalanine" 143 text c82 "proteins: Incomplete RNA sequence can translate if valid until a STOP codon" 144 note canonical case `2c44f7bf`-ba20-43f7-a3bf-`f2219c0c3f98` 145 fn tc0 to bool 146 o = new uchar 1024 0 147 n = proteins part z0 0 0 o 148 if lt n 0 149 ret false 150 end 151 ret eq ulong n 0 152 end 153 note canonical case `96d3d44f`-34a2-4db4-84cd-`fff523e069be` 154 fn tc1 to bool 155 o = new uchar 1024 0 156 n = proteins s2 o 157 if lt n 0 158 ret false 159 end 160 ret tbeq part o 0 ulong n e3 161 end 162 note canonical case `1b4c56d8`-d69f-44eb-be0e-`7b17546143d9` 163 fn tc2 to bool 164 o = new uchar 1024 0 165 n = proteins s5 o 166 if lt n 0 167 ret false 168 end 169 ret tbeq part o 0 ulong n e6 170 end 171 note canonical case `81b53646`-bd57-4732-b2cb-`6b1880e36d11` 172 fn tc3 to bool 173 o = new uchar 1024 0 174 n = proteins s8 o 175 if lt n 0 176 ret false 177 end 178 ret tbeq part o 0 ulong n e9 179 end 180 note canonical case `42f69d4f`-19d2-4d2c-a8b0-`f0ae9ee1b6b4` 181 fn tc4 to bool 182 o = new uchar 1024 0 183 n = proteins s11 o 184 if lt n 0 185 ret false 186 end 187 ret tbeq part o 0 ulong n e12 188 end 189 note canonical case `ac5edadd`-08ed-40a3-b2b9-`d82bb50424c4` 190 fn tc5 to bool 191 o = new uchar 1024 0 192 n = proteins s14 o 193 if lt n 0 194 ret false 195 end 196 ret tbeq part o 0 ulong n e15 197 end 198 note canonical case `8bc36e22`-f984-44c3-9f6b-`ee5d4e73f120` 199 fn tc6 to bool 200 o = new uchar 1024 0 201 n = proteins s17 o 202 if lt n 0 203 ret false 204 end 205 ret tbeq part o 0 ulong n e18 206 end 207 note canonical case `5c3fa5da`-4268-44e5-9f4b-`f016ccf90131` 208 fn tc7 to bool 209 o = new uchar 1024 0 210 n = proteins s20 o 211 if lt n 0 212 ret false 213 end 214 ret tbeq part o 0 ulong n e21 215 end 216 note canonical case `00579891`-b594-42b4-96dc-`7ff8bf519606` 217 fn tc8 to bool 218 o = new uchar 1024 0 219 n = proteins s23 o 220 if lt n 0 221 ret false 222 end 223 ret tbeq part o 0 ulong n e24 224 end 225 note canonical case `08c61c3b`-fa34-4950-8c4a-`133945570ef6` 226 fn tc9 to bool 227 o = new uchar 1024 0 228 n = proteins s26 o 229 if lt n 0 230 ret false 231 end 232 ret tbeq part o 0 ulong n e27 233 end 234 note canonical case `54e1e7d8`-63c0-456d-91d2-`062c72f8eef5` 235 fn tc10 to bool 236 o = new uchar 1024 0 237 n = proteins s29 o 238 if lt n 0 239 ret false 240 end 241 ret tbeq part o 0 ulong n e30 242 end 243 note canonical case `47bcfba2`-9d72-46ad-bbce-`22f7666b7eb1` 244 fn tc11 to bool 245 o = new uchar 1024 0 246 n = proteins s32 o 247 if lt n 0 248 ret false 249 end 250 ret tbeq part o 0 ulong n e33 251 end 252 note canonical case `3a691829`-fe72-43a7-8c8e-`1bd083163f72` 253 fn tc12 to bool 254 o = new uchar 1024 0 255 n = proteins s35 o 256 if lt n 0 257 ret false 258 end 259 ret tbeq part o 0 ulong n e36 260 end 261 note canonical case `1b6f8a26`-ca2f-43b8-8262-`3ee446021767` 262 fn tc13 to bool 263 o = new uchar 1024 0 264 n = proteins s38 o 265 if lt n 0 266 ret false 267 end 268 ret tbeq part o 0 ulong n e39 269 end 270 note canonical case `1e91c1eb`-02c0-48a0-9e35-`168ad0cb5f39` 271 fn tc14 to bool 272 o = new uchar 1024 0 273 n = proteins s41 o 274 if lt n 0 275 ret false 276 end 277 ret tbeq part o 0 ulong n e42 278 end 279 note canonical case `e547af0b`-aeab-49c7-9f13-`801773a73557` 280 fn tc15 to bool 281 o = new uchar 1024 0 282 n = proteins s44 o 283 if lt n 0 284 ret false 285 end 286 ret eq ulong n 0 287 end 288 note canonical case `67640947`-ff02-4f23-a2ef-`816f8a2ba72e` 289 fn tc16 to bool 290 o = new uchar 1024 0 291 n = proteins s46 o 292 if lt n 0 293 ret false 294 end 295 ret eq ulong n 0 296 end 297 note canonical case `9c2ad527`-ebc9-4ace-808b-`2b6447cb54cb` 298 fn tc17 to bool 299 o = new uchar 1024 0 300 n = proteins s48 o 301 if lt n 0 302 ret false 303 end 304 ret eq ulong n 0 305 end 306 note canonical case `f4d9d8ee`-00a8-47bf-a1e3-`1641d4428e54` 307 fn tc18 to bool 308 o = new uchar 1024 0 309 n = proteins s50 o 310 if lt n 0 311 ret false 312 end 313 ret tbeq part o 0 ulong n e51 314 end 315 note canonical case `dd22eef3`-b4f1-4ad6-bb0b-`27093c090a9d` 316 fn tc19 to bool 317 o = new uchar 1024 0 318 n = proteins s53 o 319 if lt n 0 320 ret false 321 end 322 ret tbeq part o 0 ulong n e54 323 end 324 note canonical case `d0f295df`-fb70-425c-946c-`ec2ec185388e` 325 fn tc20 to bool 326 o = new uchar 1024 0 327 n = proteins s56 o 328 if lt n 0 329 ret false 330 end 331 ret tbeq part o 0 ulong n e57 332 end 333 note canonical case `e30e8505`-97ec-4e5f-a73e-`5726a1faa1f4` 334 fn tc21 to bool 335 o = new uchar 1024 0 336 n = proteins s59 o 337 if lt n 0 338 ret false 339 end 340 ret eq ulong n 0 341 end 342 note canonical case `5358a20b`-6f4c-4893-bce4-`f929001710f3` 343 fn tc22 to bool 344 o = new uchar 1024 0 345 n = proteins s61 o 346 if lt n 0 347 ret false 348 end 349 ret tbeq part o 0 ulong n e62 350 end 351 note canonical case `ba16703a`-1a55-482f-bb07-`b21eef5093a3` 352 fn tc23 to bool 353 o = new uchar 1024 0 354 n = proteins s64 o 355 if lt n 0 356 ret false 357 end 358 ret tbeq part o 0 ulong n e65 359 end 360 note canonical case `4089bb5a`-d5b4-4e71-b79e-`b8d1f14a2911` 361 fn tc24 to bool 362 o = new uchar 1024 0 363 n = proteins s67 o 364 if lt n 0 365 ret false 366 end 367 ret tbeq part o 0 ulong n e68 368 end 369 note canonical case `2c2a2a60`-401f-4a80-b977-`e0715b23b93d` 370 fn tc25 to bool 371 o = new uchar 1024 0 372 n = proteins s70 o 373 if lt n 0 374 ret false 375 end 376 ret tbeq part o 0 ulong n e71 377 end 378 note canonical case `f6f92714`-769f-4187-9524-`e353e8a41a80` 379 fn tc26 to bool 380 o = new uchar 1024 0 381 n = proteins s73 o 382 if lt n 0 383 ret false 384 end 385 ret tbeq part o 0 ulong n e74 386 end 387 note canonical case `9eac93f3`-627a-4c90-8653-`6d0a0595bc6f` 388 fn tc27 to bool 389 o = new uchar 1024 0 390 ret eq proteins s76 o -1 391 end 392 note canonical case `9d73899f`-e68e-4291-b1e2-`7bf87c00f024` 393 fn tc28 to bool 394 o = new uchar 1024 0 395 ret eq proteins s78 o -1 396 end 397 note canonical case `43945cf7`-9968-402d-ab9f-`b8a28750b050` 398 fn tc29 to bool 399 o = new uchar 1024 0 400 n = proteins s80 o 401 if lt n 0 402 ret false 403 end 404 ret tbeq part o 0 ulong n e81 405 end 406 fn main to int 407 tcheck tc0 c1 408 tcheck tc1 c4 409 tcheck tc2 c7 410 tcheck tc3 c10 411 tcheck tc4 c13 412 tcheck tc5 c16 413 tcheck tc6 c19 414 tcheck tc7 c22 415 tcheck tc8 c25 416 tcheck tc9 c28 417 tcheck tc10 c31 418 tcheck tc11 c34 419 tcheck tc12 c37 420 tcheck tc13 c40 421 tcheck tc14 c43 422 tcheck tc15 c45 423 tcheck tc16 c47 424 tcheck tc17 c49 425 tcheck tc18 c52 426 tcheck tc19 c55 427 tcheck tc20 c58 428 tcheck tc21 c60 429 tcheck tc22 c63 430 tcheck tc23 c66 431 tcheck tc24 c69 432 tcheck tc25 c72 433 tcheck tc26 c75 434 tcheck tc27 c77 435 tcheck tc28 c79 436 tcheck tc29 c82 437 ret int get tfails 0 438 end