interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / sum-of-multiples / test.om

196 lines · 4389 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/sum-of-multiples/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 16 cases kept, 0 skipped
50text c0 "sum: no multiples within limit"
51text c1 "sum: one factor has multiples within limit"
52text c2 "sum: more than one multiple within limit"
53text c3 "sum: more than one factor with multiples within limit"
54text c4 "sum: each multiple is only counted once"
55text c5 "sum: a much larger limit"
56text c6 "sum: three factors"
57text c7 "sum: factors not relatively prime"
58text c8 "sum: some pairs of factors relatively prime and some not"
59text c9 "sum: one factor is a multiple of another"
60text c10 "sum: much larger factors"
61text c11 "sum: all numbers are multiples of 1"
62text c12 "sum: no factors means an empty sum"
63text c13 "sum: the only multiple of 0 is 0"
64text c14 "sum: the factor 0 does not affect the sum of multiples of other factors"
65text c15 "sum: solutions using include-exclude must extend to cardinality greater than 3"
66note canonical case 54aaab5a-ce86-4edc-8b40-d3ab2400a279
67fn tc0 to bool
68a0 = new ulong 2 0
69put a0 0 3
70put a0 1 5
71ret eq sum a0 1 0
72end
73note canonical case 361e4e50-c89b-4f60-95ef-5bc5c595490a
74fn tc1 to bool
75a0 = new ulong 2 0
76put a0 0 3
77put a0 1 5
78ret eq sum a0 4 3
79end
80note canonical case e644e070-040e-4ae0-9910-93c69fc3f7ce
81fn tc2 to bool
82a0 = new ulong 1 0
83put a0 0 3
84ret eq sum a0 7 9
85end
86note canonical case 607d6eb9-535c-41ce-91b5-3a61da3fa57f
87fn tc3 to bool
88a0 = new ulong 2 0
89put a0 0 3
90put a0 1 5
91ret eq sum a0 10 23
92end
93note canonical case f47e8209-c0c5-4786-b07b-dc273bf86b9b
94fn tc4 to bool
95a0 = new ulong 2 0
96put a0 0 3
97put a0 1 5
98ret eq sum a0 100 2318
99end
100note canonical case 28c4b267-c980-4054-93e9-07723db615ac
101fn tc5 to bool
102a0 = new ulong 2 0
103put a0 0 3
104put a0 1 5
105ret eq sum a0 1000 233168
106end
107note canonical case 09c4494d-ff2d-4e0f-8421-f5532821ee12
108fn tc6 to bool
109a0 = new ulong 3 0
110put a0 0 7
111put a0 1 13
112put a0 2 17
113ret eq sum a0 20 51
114end
115note canonical case 2d0d5faa-f177-4ad6-bde9-ebb865083751
116fn tc7 to bool
117a0 = new ulong 2 0
118put a0 0 4
119put a0 1 6
120ret eq sum a0 15 30
121end
122note canonical case ece8f2e8-96aa-4166-bbb7-6ce71261e354
123fn tc8 to bool
124a0 = new ulong 3 0
125put a0 0 5
126put a0 1 6
127put a0 2 8
128ret eq sum a0 150 4419
129end
130note canonical case 624fdade-6ffb-400e-8472-456a38c171c0
131fn tc9 to bool
132a0 = new ulong 2 0
133put a0 0 5
134put a0 1 25
135ret eq sum a0 51 275
136end
137note canonical case 949ee7eb-db51-479c-b5cb-4a22b40ac057
138fn tc10 to bool
139a0 = new ulong 2 0
140put a0 0 43
141put a0 1 47
142ret eq sum a0 10000 2203160
143end
144note canonical case 41093673-acbd-482c-ab80-d00a0cbedecd
145fn tc11 to bool
146a0 = new ulong 1 0
147put a0 0 1
148ret eq sum a0 100 4950
149end
150note canonical case 1730453b-baaa-438e-a9c2-d754497b2a76
151fn tc12 to bool
152a0 = new ulong 1 0
153ret eq sum part a0 0 0 10000 0
154end
155note canonical case 214a01e9-f4bf-45bb-80f1-1dce9fbb0310
156fn tc13 to bool
157a0 = new ulong 1 0
158put a0 0 0
159ret eq sum a0 1 0
160end
161note canonical case c423ae21-a0cb-4ec7-aeb1-32971af5b510
162fn tc14 to bool
163a0 = new ulong 2 0
164put a0 0 3
165put a0 1 0
166ret eq sum a0 4 3
167end
168note canonical case 17053ba9-112f-4ac0-aadb-0519dd836342
169fn tc15 to bool
170a0 = new ulong 5 0
171put a0 0 2
172put a0 1 3
173put a0 2 5
174put a0 3 7
175put a0 4 11
176ret eq sum a0 10000 39614537
177end
178fn main to int
179tcheck tc0 c0
180tcheck tc1 c1
181tcheck tc2 c2
182tcheck tc3 c3
183tcheck tc4 c4
184tcheck tc5 c5
185tcheck tc6 c6
186tcheck tc7 c7
187tcheck tc8 c8
188tcheck tc9 c9
189tcheck tc10 c10
190tcheck tc11 c11
191tcheck tc12 c12
192tcheck tc13 c13
193tcheck tc14 c14
194tcheck tc15 c15
195ret int get tfails 0
196end