interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / bob / test.om

327 lines · 7997 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/bob/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 26 cases kept, 0 skipped, 1 superseded (reimplemented) cases omitted
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 "Does this cryogenic chamber make me look fat?"
62text e1 "Sure."
63text c2 "response: asking a question"
64text s3 "WATCH OUT!"
65text e4 "Whoa, chill out!"
66text c5 "response: shouting"
67text s6 "WHAT'S GOING ON?"
68text e7 "Calm down, I know what I'm doing!"
69text c8 "response: forceful question"
70text z9 "z"
71text e10 "Fine. Be that way!"
72text c11 "response: silence"
73text s12 "Tom-ay-to, tom-aaaah-to."
74text e13 "Whatever."
75text c14 "response: stating something"
76text s15 "You are, what, like 15?"
77text e16 "Sure."
78text c17 "response: asking a numeric question"
79text s18 "fffbbcbeab?"
80text e19 "Sure."
81text c20 "response: asking gibberish"
82text s21 "4?"
83text e22 "Sure."
84text c23 "response: question with no letters"
85text s24 ":) ?"
86text e25 "Sure."
87text c26 "response: non-letters with question"
88text s27 "Wait! Hang on. Are you going to be OK?"
89text e28 "Sure."
90text c29 "response: prattling on"
91text s30 "Okay if like my spacebar quite a bit? "
92text e31 "Sure."
93text c32 "response: ending with whitespace"
94text s33 "\nDoes this cryogenic chamber make\n me look fat?"
95text e34 "Sure."
96text c35 "response: multiple line question"
97text s36 "FCECDFCAAB"
98text e37 "Whoa, chill out!"
99text c38 "response: shouting gibberish"
100text s39 "DO LIONS EAT PEOPLE? AHHHHH."
101text e40 "Whoa, chill out!"
102text c41 "response: shouting a statement containing a question mark"
103text s42 "1, 2, 3 GO!"
104text e43 "Whoa, chill out!"
105text c44 "response: shouting numbers"
106text s45 "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"
107text e46 "Whoa, chill out!"
108text c47 "response: shouting with special characters"
109text s48 "I HATE THE DENTIST"
110text e49 "Whoa, chill out!"
111text c50 "response: shouting with no exclamation mark"
112text s51 " "
113text e52 "Fine. Be that way!"
114text c53 "response: prolonged silence"
115text s54 "\t\t\t\t\t\t\t\t\t\t"
116text e55 "Fine. Be that way!"
117text c56 "response: alternate silence"
118text e57 "Fine. Be that way!"
119text c58 "response: other whitespace"
120text s59 "Hi there!"
121text e60 "Whatever."
122text c61 "response: talking forcefully"
123text s62 "It's OK if you don't want to go work for NASA."
124text e63 "Whatever."
125text c64 "response: using acronyms in regular speech"
126text s65 "1, 2, 3"
127text e66 "Whatever."
128text c67 "response: no letters"
129text s68 "Ending with ? means a question."
130text e69 "Whatever."
131text c70 "response: statement containing question mark"
132text s71 " hmmmmmmm..."
133text e72 "Whatever."
134text c73 "response: starting with whitespace"
135text s74 "This is a statement ending with whitespace "
136text e75 "Whatever."
137text c76 "response: non-question ending with whitespace"
138note canonical case 8a2e771d-d6f1-4e3f-b6c6-b41495556e37
139fn tc0 to bool
140o = new uchar 1024 0
141n = response s0 o
142ret tbeq part o 0 n e1
143end
144note canonical case 73a966dc-8017-47d6-bb32-cf07d1a5fcd9
145fn tc1 to bool
146o = new uchar 1024 0
147n = response s3 o
148ret tbeq part o 0 n e4
149end
150note canonical case a5193c61-4a92-4f68-93e2-f554eb385ec6
151fn tc2 to bool
152o = new uchar 1024 0
153n = response s6 o
154ret tbeq part o 0 n e7
155end
156note canonical case bc39f7c6-f543-41be-9a43-fd1c2f753fc0
157fn tc3 to bool
158o = new uchar 1024 0
159n = response part z9 0 0 o
160ret tbeq part o 0 n e10
161end
162note canonical case e162fead-606f-437a-a166-d051915cea8e
163fn tc4 to bool
164o = new uchar 1024 0
165n = response s12 o
166ret tbeq part o 0 n e13
167end
168note canonical case 81080c62-4e4d-4066-b30a-48d8d76920d9
169fn tc5 to bool
170o = new uchar 1024 0
171n = response s15 o
172ret tbeq part o 0 n e16
173end
174note canonical case 2a02716d-685b-4e2e-a804-2adaf281c01e
175fn tc6 to bool
176o = new uchar 1024 0
177n = response s18 o
178ret tbeq part o 0 n e19
179end
180note canonical case bb0011c5-cd52-4a5b-8bfb-a87b6283b0e2
181fn tc7 to bool
182o = new uchar 1024 0
183n = response s21 o
184ret tbeq part o 0 n e22
185end
186note canonical case 9bfc677d-ea3a-45f2-be44-35bc8fa3753e
187fn tc8 to bool
188o = new uchar 1024 0
189n = response s24 o
190ret tbeq part o 0 n e25
191end
192note canonical case 8608c508-f7de-4b17-985b-811878b3cf45
193fn tc9 to bool
194o = new uchar 1024 0
195n = response s27 o
196ret tbeq part o 0 n e28
197end
198note canonical case 05b304d6-f83b-46e7-81e0-4cd3ca647900
199fn tc10 to bool
200o = new uchar 1024 0
201n = response s30 o
202ret tbeq part o 0 n e31
203end
204note canonical case 2c7278ac-f955-4eb4-bf8f-e33eb4116a15
205fn tc11 to bool
206o = new uchar 1024 0
207n = response s33 o
208ret tbeq part o 0 n e34
209end
210note canonical case d6c98afd-df35-4806-b55e-2c457c3ab748
211fn tc12 to bool
212o = new uchar 1024 0
213n = response s36 o
214ret tbeq part o 0 n e37
215end
216note canonical case 3c954328-86fb-4c71-8961-e18d6a5e2517
217fn tc13 to bool
218o = new uchar 1024 0
219n = response s39 o
220ret tbeq part o 0 n e40
221end
222note canonical case a20e0c54-2224-4dde-8b10-bd2cdd4f61bc
223fn tc14 to bool
224o = new uchar 1024 0
225n = response s42 o
226ret tbeq part o 0 n e43
227end
228note canonical case 496143c8-1c31-4c01-8a08-88427af85c66
229fn tc15 to bool
230o = new uchar 1024 0
231n = response s45 o
232ret tbeq part o 0 n e46
233end
234note canonical case e6793c1c-43bd-4b8d-bc11-499aea73925f
235fn tc16 to bool
236o = new uchar 1024 0
237n = response s48 o
238ret tbeq part o 0 n e49
239end
240note canonical case d6c47565-372b-4b09-b1dd-c40552b8378b
241fn tc17 to bool
242o = new uchar 1024 0
243n = response s51 o
244ret tbeq part o 0 n e52
245end
246note canonical case 4428f28d-4100-4d85-a902-e5a78cb0ecd3
247fn tc18 to bool
248o = new uchar 1024 0
249n = response s54 o
250ret tbeq part o 0 n e55
251end
252note canonical case 72bd5ad3-9b2f-4931-a988-dce1f5771de2
253fn tc19 to bool
254a0 = new uchar 4 0
255put a0 0 10
256put a0 1 13
257put a0 2 32
258put a0 3 9
259o = new uchar 1024 0
260n = response a0 o
261ret tbeq part o 0 n e57
262end
263note canonical case c02f9179-ab16-4aa7-a8dc-940145c385f7
264fn tc20 to bool
265o = new uchar 1024 0
266n = response s59 o
267ret tbeq part o 0 n e60
268end
269note canonical case 153c0e25-9bb5-4ec5-966e-598463658bcd
270fn tc21 to bool
271o = new uchar 1024 0
272n = response s62 o
273ret tbeq part o 0 n e63
274end
275note canonical case f7bc4b92-bdff-421e-a238-ae97f230ccac
276fn tc22 to bool
277o = new uchar 1024 0
278n = response s65 o
279ret tbeq part o 0 n e66
280end
281note canonical case aa8097cc-c548-4951-8856-14a404dd236a
282fn tc23 to bool
283o = new uchar 1024 0
284n = response s68 o
285ret tbeq part o 0 n e69
286end
287note canonical case 5371ef75-d9ea-4103-bcfa-2da973ddec1b
288fn tc24 to bool
289o = new uchar 1024 0
290n = response s71 o
291ret tbeq part o 0 n e72
292end
293note canonical case 12983553-8601-46a8-92fa-fcaa3bc4a2a0
294fn tc25 to bool
295o = new uchar 1024 0
296n = response s74 o
297ret tbeq part o 0 n e75
298end
299fn main to int
300tcheck tc0 c2
301tcheck tc1 c5
302tcheck tc2 c8
303tcheck tc3 c11
304tcheck tc4 c14
305tcheck tc5 c17
306tcheck tc6 c20
307tcheck tc7 c23
308tcheck tc8 c26
309tcheck tc9 c29
310tcheck tc10 c32
311tcheck tc11 c35
312tcheck tc12 c38
313tcheck tc13 c41
314tcheck tc14 c44
315tcheck tc15 c47
316tcheck tc16 c50
317tcheck tc17 c53
318tcheck tc18 c56
319tcheck tc19 c58
320tcheck tc20 c61
321tcheck tc21 c64
322tcheck tc22 c67
323tcheck tc23 c70
324tcheck tc24 c73
325tcheck tc25 c76
326ret int get tfails 0
327end