interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / raindrops / test.om

225 lines · 5469 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/raindrops/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 18 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 e0 "1"
62text c1 "convert: the sound for 1 is 1"
63text e2 "Pling"
64text c3 "convert: the sound for 3 is Pling"
65text e4 "Plang"
66text c5 "convert: the sound for 5 is Plang"
67text e6 "Plong"
68text c7 "convert: the sound for 7 is Plong"
69text e8 "Pling"
70text c9 "convert: the sound for 6 is Pling as it has a factor 3"
71text e10 "8"
72text c11 "convert: 2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base"
73text e12 "Pling"
74text c13 "convert: the sound for 9 is Pling as it has a factor 3"
75text e14 "Plang"
76text c15 "convert: the sound for 10 is Plang as it has a factor 5"
77text e16 "Plong"
78text c17 "convert: the sound for 14 is Plong as it has a factor of 7"
79text e18 "PlingPlang"
80text c19 "convert: the sound for 15 is PlingPlang as it has factors 3 and 5"
81text e20 "PlingPlong"
82text c21 "convert: the sound for 21 is PlingPlong as it has factors 3 and 7"
83text e22 "Plang"
84text c23 "convert: the sound for 25 is Plang as it has a factor 5"
85text e24 "Pling"
86text c25 "convert: the sound for 27 is Pling as it has a factor 3"
87text e26 "PlangPlong"
88text c27 "convert: the sound for 35 is PlangPlong as it has factors 5 and 7"
89text e28 "Plong"
90text c29 "convert: the sound for 49 is Plong as it has a factor 7"
91text e30 "52"
92text c31 "convert: the sound for 52 is 52"
93text e32 "PlingPlangPlong"
94text c33 "convert: the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7"
95text e34 "Plang"
96text c35 "convert: the sound for 3125 is Plang as it has a factor 5"
97note canonical case 1575d549-e502-46d4-a8e1-6b7bec6123d8
98fn tc0 to bool
99o = new uchar 1024 0
100n = convert 1 o
101ret tbeq part o 0 n e0
102end
103note canonical case 1f51a9f9-4895-4539-b182-d7b0a5ab2913
104fn tc1 to bool
105o = new uchar 1024 0
106n = convert 3 o
107ret tbeq part o 0 n e2
108end
109note canonical case 2d9bfae5-2b21-4bcd-9629-c8c0e388f3e0
110fn tc2 to bool
111o = new uchar 1024 0
112n = convert 5 o
113ret tbeq part o 0 n e4
114end
115note canonical case d7e60daa-32ef-4c23-b688-2abff46c4806
116fn tc3 to bool
117o = new uchar 1024 0
118n = convert 7 o
119ret tbeq part o 0 n e6
120end
121note canonical case 6bb4947b-a724-430c-923f-f0dc3d62e56a
122fn tc4 to bool
123o = new uchar 1024 0
124n = convert 6 o
125ret tbeq part o 0 n e8
126end
127note canonical case ce51e0e8-d9d4-446d-9949-96eac4458c2d
128fn tc5 to bool
129o = new uchar 1024 0
130n = convert 8 o
131ret tbeq part o 0 n e10
132end
133note canonical case 0dd66175-e3e2-47fc-8750-d01739856671
134fn tc6 to bool
135o = new uchar 1024 0
136n = convert 9 o
137ret tbeq part o 0 n e12
138end
139note canonical case 022c44d3-2182-4471-95d7-c575af225c96
140fn tc7 to bool
141o = new uchar 1024 0
142n = convert 10 o
143ret tbeq part o 0 n e14
144end
145note canonical case 37ab74db-fed3-40ff-b7b9-04acdfea8edf
146fn tc8 to bool
147o = new uchar 1024 0
148n = convert 14 o
149ret tbeq part o 0 n e16
150end
151note canonical case 31f92999-6afb-40ee-9aa4-6d15e3334d0f
152fn tc9 to bool
153o = new uchar 1024 0
154n = convert 15 o
155ret tbeq part o 0 n e18
156end
157note canonical case ff9bb95d-6361-4602-be2c-653fe5239b54
158fn tc10 to bool
159o = new uchar 1024 0
160n = convert 21 o
161ret tbeq part o 0 n e20
162end
163note canonical case d2e75317-b72e-40ab-8a64-6734a21dece1
164fn tc11 to bool
165o = new uchar 1024 0
166n = convert 25 o
167ret tbeq part o 0 n e22
168end
169note canonical case a09c4c58-c662-4e32-97fe-f1501ef7125c
170fn tc12 to bool
171o = new uchar 1024 0
172n = convert 27 o
173ret tbeq part o 0 n e24
174end
175note canonical case bdf061de-8564-4899-a843-14b48b722789
176fn tc13 to bool
177o = new uchar 1024 0
178n = convert 35 o
179ret tbeq part o 0 n e26
180end
181note canonical case c4680bee-69ba-439d-99b5-70c5fd1a7a83
182fn tc14 to bool
183o = new uchar 1024 0
184n = convert 49 o
185ret tbeq part o 0 n e28
186end
187note canonical case 17f2bc9a-b65a-4d23-8ccd-266e8c271444
188fn tc15 to bool
189o = new uchar 1024 0
190n = convert 52 o
191ret tbeq part o 0 n e30
192end
193note canonical case e46677ed-ff1a-419f-a740-5c713d2830e4
194fn tc16 to bool
195o = new uchar 1024 0
196n = convert 105 o
197ret tbeq part o 0 n e32
198end
199note canonical case 13c6837a-0fcd-4b86-a0eb-20572f7deb0b
200fn tc17 to bool
201o = new uchar 1024 0
202n = convert 3125 o
203ret tbeq part o 0 n e34
204end
205fn main to int
206tcheck tc0 c1
207tcheck tc1 c3
208tcheck tc2 c5
209tcheck tc3 c7
210tcheck tc4 c9
211tcheck tc5 c11
212tcheck tc6 c13
213tcheck tc7 c15
214tcheck tc8 c17
215tcheck tc9 c19
216tcheck tc10 c21
217tcheck tc11 c23
218tcheck tc12 c25
219tcheck tc13 c27
220tcheck tc14 c29
221tcheck tc15 c31
222tcheck tc16 c33
223tcheck tc17 c35
224ret int get tfails 0
225end