interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / largest-series-product / test.om

157 lines · 4345 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/largest-series-product/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 15 cases kept, 0 skipped, 3 superseded (reimplemented) cases omitted
50text s0 "29"
51text c1 "largestProduct: finds the largest product if span equals length"
52text s2 "0123456789"
53text c3 "largestProduct: can find the largest product of 2 with numbers in order"
54text s4 "576802143"
55text c5 "largestProduct: can find the largest product of 2"
56text s6 "0123456789"
57text c7 "largestProduct: can find the largest product of 3 with numbers in order"
58text s8 "1027839564"
59text c9 "largestProduct: can find the largest product of 3"
60text s10 "0123456789"
61text c11 "largestProduct: can find the largest product of 5 with numbers in order"
62text s12 "73167176531330624919225119674426574742355349194934"
63text c13 "largestProduct: can get the largest product of a big number"
64text s14 "0000"
65text c15 "largestProduct: reports zero if the only digits are zero"
66text s16 "99099"
67text c17 "largestProduct: reports zero if all spans include zero"
68text s18 "123"
69text c19 "largestProduct: rejects span longer than string length"
70text z20 "z"
71text c21 "largestProduct: reports 1 for empty string and empty product (0 span)"
72text s22 "123"
73text c23 "largestProduct: reports 1 for nonempty string and empty product (0 span)"
74text z24 "z"
75text c25 "largestProduct: rejects empty string and nonzero span"
76text s26 "1234a5"
77text c27 "largestProduct: rejects invalid character in digits"
78text s28 "12345"
79text c29 "largestProduct: rejects negative span"
80note canonical case 7c82f8b7-e347-48ee-8a22-f672323324d4
81fn tc0 to bool
82ret eq largestproduct s0 2 18
83end
84note canonical case 88523f65-21ba-4458-a76a-b4aaf6e4cb5e
85fn tc1 to bool
86ret eq largestproduct s2 2 72
87end
88note canonical case f1376b48-1157-419d-92c2-1d7e36a70b8a
89fn tc2 to bool
90ret eq largestproduct s4 2 48
91end
92note canonical case 46356a67-7e02-489e-8fea-321c2fa7b4a4
93fn tc3 to bool
94ret eq largestproduct s6 3 504
95end
96note canonical case a2dcb54b-2b8f-4993-92dd-5ce56dece64a
97fn tc4 to bool
98ret eq largestproduct s8 3 270
99end
100note canonical case 673210a3-33cd-4708-940b-c482d7a88f9d
101fn tc5 to bool
102ret eq largestproduct s10 5 15120
103end
104note canonical case 02acd5a6-3bbf-46df-8282-8b313a80a7c9
105fn tc6 to bool
106ret eq largestproduct s12 6 23520
107end
108note canonical case 76dcc407-21e9-424c-a98e-609f269622b5
109fn tc7 to bool
110ret eq largestproduct s14 2 0
111end
112note canonical case 6ef0df9f-52d4-4a5d-b210-f6fae5f20e19
113fn tc8 to bool
114ret eq largestproduct s16 3 0
115end
116note canonical case 0ae1ce53-d9ba-41bb-827f-2fceb64f058b
117fn tc9 to bool
118ret eq largestproduct s18 4 -2
119end
120note canonical case 06bc8b90-0c51-4c54-ac22-3ec3893a079e
121fn tc10 to bool
122ret eq largestproduct part z20 0 0 0 1
123end
124note canonical case 3ec0d92e-f2e2-4090-a380-70afee02f4c0
125fn tc11 to bool
126ret eq largestproduct s22 0 1
127end
128note canonical case 6cf66098-a6af-4223-aab1-26aeeefc7402
129fn tc12 to bool
130ret eq largestproduct part z24 0 0 1 -2
131end
132note canonical case 7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74
133fn tc13 to bool
134ret eq largestproduct s26 2 -3
135end
136note canonical case c859f34a-9bfe-4897-9c2f-6d7f8598e7f0
137fn tc14 to bool
138ret eq largestproduct s28 -1 -1
139end
140fn main to int
141tcheck tc0 c1
142tcheck tc1 c3
143tcheck tc2 c5
144tcheck tc3 c7
145tcheck tc4 c9
146tcheck tc5 c11
147tcheck tc6 c13
148tcheck tc7 c15
149tcheck tc8 c17
150tcheck tc9 c19
151tcheck tc10 c21
152tcheck tc11 c23
153tcheck tc12 c25
154tcheck tc13 c27
155tcheck tc14 c29
156ret int get tfails 0
157end