interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / rna-transcription / test.om

122 lines · 2577 bytes Raw Blame History
1note ---- test harness (appended after the solution by exercise.sh) ----
2text tok "ok "
3text tnok "not ok "
4text tsep " - "
5text tnl "\n"
6global tfails ulong 1
7global tnum ulong 1
8fn temit a view uchar * to void
9o = ulong 0
10while lt o len a bound 4096
11k = write 1 a o sub len a o
12if le k 0
13exit 2
14end
15o = add o ulong k
16end
17end
18fn temitu n ulong to void
19d = new uchar 20 0
20i = ulong 20
21v = n
22while true bound 20
23i = sub i 1
24put d i uchar add rem v 10 48
25v = div v 10
26if eq v 0
27break
28end
29end
30temit part d i sub 20 i
31end
32note one TAP-style line per case; main returns the number of failed cases
33fn tcheck c bool what view uchar * to void
34put tnum 0 add get tnum 0 1
35if c
36temit tok
37else
38temit tnok
39put tfails 0 add get tfails 0 1
40end
41temitu get tnum 0
42temit tsep
43temit what
44temit tnl
45end
46note cases: exercism/problem-specifications exercises/rna-transcription/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 6 cases kept, 0 skipped
50fn tbeq a view uchar * b view uchar * to bool
51if ne len a len b
52ret false
53end
54for i ulong len a
55if ne get a i get b i
56ret false
57end
58end
59ret true
60end
61text z0 "z"
62text c1 "toRna: Empty RNA sequence"
63text s2 "C"
64text e3 "G"
65text c4 "toRna: RNA complement of cytosine is guanine"
66text s5 "G"
67text e6 "C"
68text c7 "toRna: RNA complement of guanine is cytosine"
69text s8 "T"
70text e9 "A"
71text c10 "toRna: RNA complement of thymine is adenine"
72text s11 "A"
73text e12 "U"
74text c13 "toRna: RNA complement of adenine is uracil"
75text s14 "ACGTGGTCTTAA"
76text e15 "UGCACCAGAAUU"
77text c16 "toRna: RNA complement"
78note canonical case b4631f82-c98c-4a2f-90b3-c5c2b6c6f661
79fn tc0 to bool
80o = new uchar 1024 0
81n = torna part z0 0 0 o
82ret eq n 0
83end
84note canonical case a9558a3c-318c-4240-9256-5d5ed47005a6
85fn tc1 to bool
86o = new uchar 1024 0
87n = torna s2 o
88ret tbeq part o 0 n e3
89end
90note canonical case 6eedbb5c-12cb-4c8b-9f51-f8320b4dc2e7
91fn tc2 to bool
92o = new uchar 1024 0
93n = torna s5 o
94ret tbeq part o 0 n e6
95end
96note canonical case 870bd3ec-8487-471d-8d9a-a25046488d3e
97fn tc3 to bool
98o = new uchar 1024 0
99n = torna s8 o
100ret tbeq part o 0 n e9
101end
102note canonical case aade8964-02e1-4073-872f-42d3ffd74c5f
103fn tc4 to bool
104o = new uchar 1024 0
105n = torna s11 o
106ret tbeq part o 0 n e12
107end
108note canonical case 79ed2757-f018-4f47-a1d7-34a559392dbf
109fn tc5 to bool
110o = new uchar 1024 0
111n = torna s14 o
112ret tbeq part o 0 n e15
113end
114fn main to int
115tcheck tc0 c1
116tcheck tc1 c4
117tcheck tc2 c7
118tcheck tc3 c10
119tcheck tc4 c13
120tcheck tc5 c16
121ret int get tfails 0
122end