interplane.Get Omega
Read in your language

omega-rosetta

aien-dev/omega-rosetta

Brought by drakestapleton

branch main Branches Tags History

omega-rosetta / exercises / resistor-color-duo / test.om

101 lines · 2267 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/resistor-color-duo/canonical-data.json at
47note commit 650bebeb39ad40439175288042aece982b0a90a9 (2026-10-19), MIT licence,
48note https://github.com/exercism/problem-specifications
49note 7 cases kept, 0 skipped
50text s0 "brown,black"
51text c1 "value: Brown and black"
52text s2 "blue,grey"
53text c3 "value: Blue and grey"
54text s4 "yellow,violet"
55text c5 "value: Yellow and violet"
56text s6 "white,red"
57text c7 "value: White and red"
58text s8 "orange,orange"
59text c9 "value: Orange and orange"
60text s10 "green,brown,orange"
61text c11 "value: Ignore additional colors"
62text s12 "black,brown"
63text c13 "value: Black and brown, one-digit"
64note canonical case ce11995a-5b93-4950-a5e9-93423693b2fc
65fn tc0 to bool
66ret eq value s0 10
67end
68note canonical case 7bf82f7a-af23-48ba-a97d-38d59406a920
69fn tc1 to bool
70ret eq value s2 68
71end
72note canonical case f1886361-fdfd-4693-acf8-46726fe24e0c
73fn tc2 to bool
74ret eq value s4 47
75end
76note canonical case b7a6cbd2-ae3c-470a-93eb-56670b305640
77fn tc3 to bool
78ret eq value s6 92
79end
80note canonical case 77a8293d-2a83-4016-b1af-991acc12b9fe
81fn tc4 to bool
82ret eq value s8 33
83end
84note canonical case 0c4fb44f-db7c-4d03-afa8-054350f156a8
85fn tc5 to bool
86ret eq value s10 51
87end
88note canonical case 4a8ceec5-0ab4-4904-88a4-daf953a5e818
89fn tc6 to bool
90ret eq value s12 1
91end
92fn main to int
93tcheck tc0 c1
94tcheck tc1 c3
95tcheck tc2 c5
96tcheck tc3 c7
97tcheck tc4 c9
98tcheck tc5 c11
99tcheck tc6 c13
100ret int get tfails 0
101end