interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / si / rosetta / exercises / scrabble-score / test.om

129 lines · 2879 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/scrabble-score/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 11 cases kept, 0 skipped
50text s0 "a"
51text c1 "score: lowercase letter"
52text s2 "A"
53text c3 "score: uppercase letter"
54text s4 "f"
55text c5 "score: valuable letter"
56text s6 "at"
57text c7 "score: short word"
58text s8 "zoo"
59text c9 "score: short, valuable word"
60text s10 "street"
61text c11 "score: medium word"
62text s12 "quirky"
63text c13 "score: medium, valuable word"
64text s14 "OxyphenButazone"
65text c15 "score: long, mixed-case word"
66text s16 "pinata"
67text c17 "score: english-like word"
68text z18 "z"
69text c19 "score: empty input"
70text s20 "abcdefghijklmnopqrstuvwxyz"
71text c21 "score: entire alphabet available"
72note canonical case f46cda29-1ca5-4ef2-bd45-388a767e3db2
73fn tc0 to bool
74ret eq score s0 1
75end
76note canonical case f7794b49-f13e-45d1-a933-4e48459b2201
77fn tc1 to bool
78ret eq score s2 1
79end
80note canonical case eaba9c76-f9fa-49c9-a1b0-d1ba3a5b31fa
81fn tc2 to bool
82ret eq score s4 4
83end
84note canonical case f3c8c94e-bb48-4da2-b09f-e832e103151e
85fn tc3 to bool
86ret eq score s6 2
87end
88note canonical case 71e3d8fa-900d-4548-930e-68e7067c4615
89fn tc4 to bool
90ret eq score s8 12
91end
92note canonical case d3088ad9-570c-4b51-8764-c75d5a430e99
93fn tc5 to bool
94ret eq score s10 6
95end
96note canonical case fa20c572-ad86-400a-8511-64512daac352
97fn tc6 to bool
98ret eq score s12 22
99end
100note canonical case 9336f0ba-9c2b-4fa0-bd1c-2e2d328cf967
101fn tc7 to bool
102ret eq score s14 41
103end
104note canonical case 1e34e2c3-e444-4ea7-b598-3c2b46fd2c10
105fn tc8 to bool
106ret eq score s16 8
107end
108note canonical case 4efe3169-b3b6-4334-8bae-ff4ef24a7e4f
109fn tc9 to bool
110ret eq score part z18 0 0 0
111end
112note canonical case 3b305c1c-f260-4e15-a5b5-cb7d3ea7c3d7
113fn tc10 to bool
114ret eq score s20 87
115end
116fn main to int
117tcheck tc0 c1
118tcheck tc1 c3
119tcheck tc2 c5
120tcheck tc3 c7
121tcheck tc4 c9
122tcheck tc5 c11
123tcheck tc6 c13
124tcheck tc7 c15
125tcheck tc8 c17
126tcheck tc9 c19
127tcheck tc10 c21
128ret int get tfails 0
129end