interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / allergies / test.om

432 lines · 12582 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/allergies/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 50 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 s0 "eggs"
62text c1 "allergicTo: testing for eggs allergy / not allergic to anything"
63text s2 "eggs"
64text c3 "allergicTo: testing for eggs allergy / allergic only to eggs"
65text s4 "eggs"
66text c5 "allergicTo: testing for eggs allergy / allergic to eggs and something else"
67text s6 "eggs"
68text c7 "allergicTo: testing for eggs allergy / allergic to something, but not eggs"
69text s8 "eggs"
70text c9 "allergicTo: testing for eggs allergy / allergic to everything"
71text s10 "peanuts"
72text c11 "allergicTo: testing for peanuts allergy / not allergic to anything"
73text s12 "peanuts"
74text c13 "allergicTo: testing for peanuts allergy / allergic only to peanuts"
75text s14 "peanuts"
76text c15 "allergicTo: testing for peanuts allergy / allergic to peanuts and something else"
77text s16 "peanuts"
78text c17 "allergicTo: testing for peanuts allergy / allergic to something, but not peanuts"
79text s18 "peanuts"
80text c19 "allergicTo: testing for peanuts allergy / allergic to everything"
81text s20 "shellfish"
82text c21 "allergicTo: testing for shellfish allergy / not allergic to anything"
83text s22 "shellfish"
84text c23 "allergicTo: testing for shellfish allergy / allergic only to shellfish"
85text s24 "shellfish"
86text c25 "allergicTo: testing for shellfish allergy / allergic to shellfish and something else"
87text s26 "shellfish"
88text c27 "allergicTo: testing for shellfish allergy / allergic to something, but not shellfish"
89text s28 "shellfish"
90text c29 "allergicTo: testing for shellfish allergy / allergic to everything"
91text s30 "strawberries"
92text c31 "allergicTo: testing for strawberries allergy / not allergic to anything"
93text s32 "strawberries"
94text c33 "allergicTo: testing for strawberries allergy / allergic only to strawberries"
95text s34 "strawberries"
96text c35 "allergicTo: testing for strawberries allergy / allergic to strawberries and something else"
97text s36 "strawberries"
98text c37 "allergicTo: testing for strawberries allergy / allergic to something, but not strawberries"
99text s38 "strawberries"
100text c39 "allergicTo: testing for strawberries allergy / allergic to everything"
101text s40 "tomatoes"
102text c41 "allergicTo: testing for tomatoes allergy / not allergic to anything"
103text s42 "tomatoes"
104text c43 "allergicTo: testing for tomatoes allergy / allergic only to tomatoes"
105text s44 "tomatoes"
106text c45 "allergicTo: testing for tomatoes allergy / allergic to tomatoes and something else"
107text s46 "tomatoes"
108text c47 "allergicTo: testing for tomatoes allergy / allergic to something, but not tomatoes"
109text s48 "tomatoes"
110text c49 "allergicTo: testing for tomatoes allergy / allergic to everything"
111text s50 "chocolate"
112text c51 "allergicTo: testing for chocolate allergy / not allergic to anything"
113text s52 "chocolate"
114text c53 "allergicTo: testing for chocolate allergy / allergic only to chocolate"
115text s54 "chocolate"
116text c55 "allergicTo: testing for chocolate allergy / allergic to chocolate and something else"
117text s56 "chocolate"
118text c57 "allergicTo: testing for chocolate allergy / allergic to something, but not chocolate"
119text s58 "chocolate"
120text c59 "allergicTo: testing for chocolate allergy / allergic to everything"
121text s60 "pollen"
122text c61 "allergicTo: testing for pollen allergy / not allergic to anything"
123text s62 "pollen"
124text c63 "allergicTo: testing for pollen allergy / allergic only to pollen"
125text s64 "pollen"
126text c65 "allergicTo: testing for pollen allergy / allergic to pollen and something else"
127text s66 "pollen"
128text c67 "allergicTo: testing for pollen allergy / allergic to something, but not pollen"
129text s68 "pollen"
130text c69 "allergicTo: testing for pollen allergy / allergic to everything"
131text s70 "cats"
132text c71 "allergicTo: testing for cats allergy / not allergic to anything"
133text s72 "cats"
134text c73 "allergicTo: testing for cats allergy / allergic only to cats"
135text s74 "cats"
136text c75 "allergicTo: testing for cats allergy / allergic to cats and something else"
137text s76 "cats"
138text c77 "allergicTo: testing for cats allergy / allergic to something, but not cats"
139text s78 "cats"
140text c79 "allergicTo: testing for cats allergy / allergic to everything"
141text c80 "list: list when: / no allergies"
142text e81 "eggs"
143text c82 "list: list when: / just eggs"
144text e83 "peanuts"
145text c84 "list: list when: / just peanuts"
146text e85 "strawberries"
147text c86 "list: list when: / just strawberries"
148text e87 "eggs,peanuts"
149text c88 "list: list when: / eggs and peanuts"
150text e89 "eggs,shellfish"
151text c90 "list: list when: / more than eggs but not peanuts"
152text e91 "strawberries,tomatoes,chocolate,pollen,cats"
153text c92 "list: list when: / lots of stuff"
154text e93 "eggs,peanuts,shellfish,strawberries,tomatoes,chocolate,pollen,cats"
155text c94 "list: list when: / everything"
156text e95 "eggs,shellfish,strawberries,tomatoes,chocolate,pollen,cats"
157text c96 "list: list when: / no allergen score parts"
158text e97 "eggs"
159text c98 "list: list when: / no allergen score parts without highest valid score"
160note canonical case 17fc7296-2440-4ac4-ad7b-d07c321bc5a0
161fn tc0 to bool
162ret eq allergicto s0 0 false
163end
164note canonical case 07ced27b-1da5-4c2e-8ae2-cb2791437546
165fn tc1 to bool
166ret eq allergicto s2 1 true
167end
168note canonical case 5035b954-b6fa-4b9b-a487-dae69d8c5f96
169fn tc2 to bool
170ret eq allergicto s4 3 true
171end
172note canonical case 64a6a83a-5723-4b5b-a896-663307403310
173fn tc3 to bool
174ret eq allergicto s6 2 false
175end
176note canonical case 90c8f484-456b-41c4-82ba-2d08d93231c6
177fn tc4 to bool
178ret eq allergicto s8 255 true
179end
180note canonical case d266a59a-fccc-413b-ac53-d57cb1f0db9d
181fn tc5 to bool
182ret eq allergicto s10 0 false
183end
184note canonical case ea210a98-860d-46b2-a5bf-50d8995b3f2a
185fn tc6 to bool
186ret eq allergicto s12 2 true
187end
188note canonical case eac69ae9-8d14-4291-ac4b-7fd2c73d3a5b
189fn tc7 to bool
190ret eq allergicto s14 7 true
191end
192note canonical case 9152058c-ce39-4b16-9b1d-283ec6d25085
193fn tc8 to bool
194ret eq allergicto s16 5 false
195end
196note canonical case d2d71fd8-63d5-40f9-a627-fbdaf88caeab
197fn tc9 to bool
198ret eq allergicto s18 255 true
199end
200note canonical case b948b0a1-cbf7-4b28-a244-73ff56687c80
201fn tc10 to bool
202ret eq allergicto s20 0 false
203end
204note canonical case 9ce9a6f3-53e9-4923-85e0-73019047c567
205fn tc11 to bool
206ret eq allergicto s22 4 true
207end
208note canonical case b272fca5-57ba-4b00-bd0c-43a737ab2131
209fn tc12 to bool
210ret eq allergicto s24 14 true
211end
212note canonical case 21ef8e17-c227-494e-8e78-470a1c59c3d8
213fn tc13 to bool
214ret eq allergicto s26 10 false
215end
216note canonical case cc789c19-2b5e-4c67-b146-625dc8cfa34e
217fn tc14 to bool
218ret eq allergicto s28 255 true
219end
220note canonical case 651bde0a-2a74-46c4-ab55-02a0906ca2f5
221fn tc15 to bool
222ret eq allergicto s30 0 false
223end
224note canonical case b649a750-9703-4f5f-b7f7-91da2c160ece
225fn tc16 to bool
226ret eq allergicto s32 8 true
227end
228note canonical case 50f5f8f3-3bac-47e6-8dba-2d94470a4bc6
229fn tc17 to bool
230ret eq allergicto s34 28 true
231end
232note canonical case 23dd6952-88c9-48d7-a7d5-5d0343deb18d
233fn tc18 to bool
234ret eq allergicto s36 20 false
235end
236note canonical case 74afaae2-13b6-43a2-837a-286cd42e7d7e
237fn tc19 to bool
238ret eq allergicto s38 255 true
239end
240note canonical case c49a91ef-6252-415e-907e-a9d26ef61723
241fn tc20 to bool
242ret eq allergicto s40 0 false
243end
244note canonical case b69c5131-b7d0-41ad-a32c-e1b2cc632df8
245fn tc21 to bool
246ret eq allergicto s42 16 true
247end
248note canonical case 1ca50eb1-f042-4ccf-9050-341521b929ec
249fn tc22 to bool
250ret eq allergicto s44 56 true
251end
252note canonical case e9846baa-456b-4eff-8025-034b9f77bd8e
253fn tc23 to bool
254ret eq allergicto s46 40 false
255end
256note canonical case b2414f01-f3ad-4965-8391-e65f54dad35f
257fn tc24 to bool
258ret eq allergicto s48 255 true
259end
260note canonical case 978467ab-bda4-49f7-b004-1d011ead947c
261fn tc25 to bool
262ret eq allergicto s50 0 false
263end
264note canonical case 59cf4e49-06ea-4139-a2c1-d7aad28f8cbc
265fn tc26 to bool
266ret eq allergicto s52 32 true
267end
268note canonical case b0a7c07b-2db7-4f73-a180-565e07040ef1
269fn tc27 to bool
270ret eq allergicto s54 112 true
271end
272note canonical case f5506893-f1ae-482a-b516-7532ba5ca9d2
273fn tc28 to bool
274ret eq allergicto s56 80 false
275end
276note canonical case 02debb3d-d7e2-4376-a26b-3c974b6595c6
277fn tc29 to bool
278ret eq allergicto s58 255 true
279end
280note canonical case 17f4a42b-c91e-41b8-8a76-4797886c2d96
281fn tc30 to bool
282ret eq allergicto s60 0 false
283end
284note canonical case 7696eba7-1837-4488-882a-14b7b4e3e399
285fn tc31 to bool
286ret eq allergicto s62 64 true
287end
288note canonical case 9a49aec5-fa1f-405d-889e-4dfc420db2b6
289fn tc32 to bool
290ret eq allergicto s64 224 true
291end
292note canonical case 3cb8e79f-d108-4712-b620-aa146b1954a9
293fn tc33 to bool
294ret eq allergicto s66 160 false
295end
296note canonical case 1dc3fe57-7c68-4043-9d51-5457128744b2
297fn tc34 to bool
298ret eq allergicto s68 255 true
299end
300note canonical case d3f523d6-3d50-419b-a222-d4dfd62ce314
301fn tc35 to bool
302ret eq allergicto s70 0 false
303end
304note canonical case eba541c3-c886-42d3-baef-c048cb7fcd8f
305fn tc36 to bool
306ret eq allergicto s72 128 true
307end
308note canonical case ba718376-26e0-40b7-bbbe-060287637ea5
309fn tc37 to bool
310ret eq allergicto s74 192 true
311end
312note canonical case 3c6dbf4a-5277-436f-8b88-15a206f2d6c4
313fn tc38 to bool
314ret eq allergicto s76 64 false
315end
316note canonical case 1faabb05-2b98-4995-9046-d83e4a48a7c1
317fn tc39 to bool
318ret eq allergicto s78 255 true
319end
320note canonical case f9c1b8e7-7dc5-4887-aa93-cebdcc29dd8f
321fn tc40 to bool
322o = new uchar 1024 0
323n = list 0 o
324ret eq n 0
325end
326note canonical case 9e1a4364-09a6-4d94-990f-541a94a4c1e8
327fn tc41 to bool
328o = new uchar 1024 0
329n = list 1 o
330ret tbeq part o 0 n e81
331end
332note canonical case 8851c973-805e-4283-9e01-d0c0da0e4695
333fn tc42 to bool
334o = new uchar 1024 0
335n = list 2 o
336ret tbeq part o 0 n e83
337end
338note canonical case 2c8943cb-005e-435f-ae11-3e8fb558ea98
339fn tc43 to bool
340o = new uchar 1024 0
341n = list 8 o
342ret tbeq part o 0 n e85
343end
344note canonical case 6fa95d26-044c-48a9-8a7b-9ee46ec32c5c
345fn tc44 to bool
346o = new uchar 1024 0
347n = list 3 o
348ret tbeq part o 0 n e87
349end
350note canonical case 19890e22-f63f-4c5c-a9fb-fb6eacddfe8e
351fn tc45 to bool
352o = new uchar 1024 0
353n = list 5 o
354ret tbeq part o 0 n e89
355end
356note canonical case 4b68f470-067c-44e4-889f-c9fe28917d2f
357fn tc46 to bool
358o = new uchar 1024 0
359n = list 248 o
360ret tbeq part o 0 n e91
361end
362note canonical case 0881b7c5-9efa-4530-91bd-68370d054bc7
363fn tc47 to bool
364o = new uchar 1024 0
365n = list 255 o
366ret tbeq part o 0 n e93
367end
368note canonical case 12ce86de-b347-42a0-ab7c-2e0570f0c65b
369fn tc48 to bool
370o = new uchar 1024 0
371n = list 509 o
372ret tbeq part o 0 n e95
373end
374note canonical case 93c2df3e-4f55-4fed-8116-7513092819cd
375fn tc49 to bool
376o = new uchar 1024 0
377n = list 257 o
378ret tbeq part o 0 n e97
379end
380fn main to int
381tcheck tc0 c1
382tcheck tc1 c3
383tcheck tc2 c5
384tcheck tc3 c7
385tcheck tc4 c9
386tcheck tc5 c11
387tcheck tc6 c13
388tcheck tc7 c15
389tcheck tc8 c17
390tcheck tc9 c19
391tcheck tc10 c21
392tcheck tc11 c23
393tcheck tc12 c25
394tcheck tc13 c27
395tcheck tc14 c29
396tcheck tc15 c31
397tcheck tc16 c33
398tcheck tc17 c35
399tcheck tc18 c37
400tcheck tc19 c39
401tcheck tc20 c41
402tcheck tc21 c43
403tcheck tc22 c45
404tcheck tc23 c47
405tcheck tc24 c49
406tcheck tc25 c51
407tcheck tc26 c53
408tcheck tc27 c55
409tcheck tc28 c57
410tcheck tc29 c59
411tcheck tc30 c61
412tcheck tc31 c63
413tcheck tc32 c65
414tcheck tc33 c67
415tcheck tc34 c69
416tcheck tc35 c71
417tcheck tc36 c73
418tcheck tc37 c75
419tcheck tc38 c77
420tcheck tc39 c79
421tcheck tc40 c80
422tcheck tc41 c82
423tcheck tc42 c84
424tcheck tc43 c86
425tcheck tc44 c88
426tcheck tc45 c90
427tcheck tc46 c92
428tcheck tc47 c94
429tcheck tc48 c96
430tcheck tc49 c98
431ret int get tfails 0
432end