interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / acronym / test.om

153 lines · 3511 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/acronym/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 9 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 "Portable Network Graphics"
62text e1 "PNG"
63text c2 "abbreviate: basic"
64text s3 "Ruby on Rails"
65text e4 "ROR"
66text c5 "abbreviate: lowercase words"
67text s6 "First In, First Out"
68text e7 "FIFO"
69text c8 "abbreviate: punctuation"
70text s9 "GNU Image Manipulation Program"
71text e10 "GIMP"
72text c11 "abbreviate: all caps word"
73text s12 "Complementary metal-oxide semiconductor"
74text e13 "CMOS"
75text c14 "abbreviate: punctuation without whitespace"
76text s15 "Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me"
77text e16 "ROTFLSHTMDCOALM"
78text c17 "abbreviate: very long abbreviation"
79text s18 "Something - I made up from thin air"
80text e19 "SIMUFTA"
81text c20 "abbreviate: consecutive delimiters"
82text s21 "Halley's Comet"
83text e22 "HC"
84text c23 "abbreviate: apostrophes"
85text s24 "The Road _Not_ Taken"
86text e25 "TRNT"
87text c26 "abbreviate: underscore emphasis"
88note canonical case 1e22cceb-c5e4-4562-9afe-aef07ad1eaf4
89fn tc0 to bool
90o = new uchar 1024 0
91n = abbreviate s0 o
92ret tbeq part o 0 n e1
93end
94note canonical case 79ae3889-a5c0-4b01-baf0-232d31180c08
95fn tc1 to bool
96o = new uchar 1024 0
97n = abbreviate s3 o
98ret tbeq part o 0 n e4
99end
100note canonical case ec7000a7-3931-4a17-890e-33ca2073a548
101fn tc2 to bool
102o = new uchar 1024 0
103n = abbreviate s6 o
104ret tbeq part o 0 n e7
105end
106note canonical case 32dd261c-0c92-469a-9c5c-b192e94a63b0
107fn tc3 to bool
108o = new uchar 1024 0
109n = abbreviate s9 o
110ret tbeq part o 0 n e10
111end
112note canonical case ae2ac9fa-a606-4d05-8244-3bcc4659c1d4
113fn tc4 to bool
114o = new uchar 1024 0
115n = abbreviate s12 o
116ret tbeq part o 0 n e13
117end
118note canonical case 0e4b1e7c-1a6d-48fb-81a7-bf65eb9e69f9
119fn tc5 to bool
120o = new uchar 1024 0
121n = abbreviate s15 o
122ret tbeq part o 0 n e16
123end
124note canonical case 6a078f49-c68d-4b7b-89af-33a1a98c28cc
125fn tc6 to bool
126o = new uchar 1024 0
127n = abbreviate s18 o
128ret tbeq part o 0 n e19
129end
130note canonical case 5118b4b1-4572-434c-8d57-5b762e57973e
131fn tc7 to bool
132o = new uchar 1024 0
133n = abbreviate s21 o
134ret tbeq part o 0 n e22
135end
136note canonical case adc12eab-ec2d-414f-b48c-66a4fc06cdef
137fn tc8 to bool
138o = new uchar 1024 0
139n = abbreviate s24 o
140ret tbeq part o 0 n e25
141end
142fn main to int
143tcheck tc0 c2
144tcheck tc1 c5
145tcheck tc2 c8
146tcheck tc3 c11
147tcheck tc4 c14
148tcheck tc5 c17
149tcheck tc6 c20
150tcheck tc7 c23
151tcheck tc8 c26
152ret int get tfails 0
153end