interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / darts / test.om

130 lines · 3137 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/darts/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 13 cases kept, 0 skipped
50text c0 "score: Missed target"
51text c1 "score: On the outer circle"
52text c2 "score: On the middle circle"
53text c3 "score: On the inner circle"
54text c4 "score: Exactly on center"
55text c5 "score: Near the center"
56text c6 "score: Just within the inner circle"
57text c7 "score: Just outside the inner circle"
58text c8 "score: Just within the middle circle"
59text c9 "score: Just outside the middle circle"
60text c10 "score: Just within the outer circle"
61text c11 "score: Just outside the outer circle"
62text c12 "score: Asymmetric position between the inner and middle circles"
63note canonical case 9033f731-0a3a-4d9c-b1c0-34a1c8362afb
64fn tc0 to bool
65ret eq score -9.0 9.0 0
66end
67note canonical case 4c9f6ff4-c489-45fd-be8a-1fcb08b4d0ba
68fn tc1 to bool
69ret eq score 0.0 10.0 1
70end
71note canonical case 14378687-ee58-4c9b-a323-b089d5274be8
72fn tc2 to bool
73ret eq score -5.0 0.0 5
74end
75note canonical case 849e2e63-85bd-4fed-bc3b-781ae962e2c9
76fn tc3 to bool
77ret eq score 0.0 -1.0 10
78end
79note canonical case 1c5ffd9f-ea66-462f-9f06-a1303de5a226
80fn tc4 to bool
81ret eq score 0.0 0.0 10
82end
83note canonical case b65abce3-a679-4550-8115-4b74bda06088
84fn tc5 to bool
85ret eq score -0.1 -0.1 10
86end
87note canonical case 66c29c1d-44f5-40cf-9927-e09a1305b399
88fn tc6 to bool
89ret eq score 0.7 0.7 10
90end
91note canonical case d1012f63-c97c-4394-b944-7beb3d0b141a
92fn tc7 to bool
93ret eq score 0.8 -0.8 5
94end
95note canonical case ab2b5666-b0b4-49c3-9b27-205e790ed945
96fn tc8 to bool
97ret eq score -3.5 3.5 5
98end
99note canonical case 70f1424e-d690-4860-8caf-9740a52c0161
100fn tc9 to bool
101ret eq score -3.6 -3.6 1
102end
103note canonical case a7dbf8db-419c-4712-8a7f-67602b69b293
104fn tc10 to bool
105ret eq score -7.0 7.0 1
106end
107note canonical case e0f39315-9f9a-4546-96e4-a9475b885aa7
108fn tc11 to bool
109ret eq score 7.1 -7.1 0
110end
111note canonical case 045d7d18-d863-4229-818e-b50828c75d19
112fn tc12 to bool
113ret eq score 0.5 -4.0 5
114end
115fn main to int
116tcheck tc0 c0
117tcheck tc1 c1
118tcheck tc2 c2
119tcheck tc3 c3
120tcheck tc4 c4
121tcheck tc5 c5
122tcheck tc6 c6
123tcheck tc7 c7
124tcheck tc8 c8
125tcheck tc9 c9
126tcheck tc10 c10
127tcheck tc11 c11
128tcheck tc12 c12
129ret int get tfails 0
130end