forked from exercism/raku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-data.yaml
33 lines (29 loc) · 912 Bytes
/
template-data.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
unit: module
properties:
label:
test: |-
sprintf(q:to/END/, %case<input><colors>.List.Str, %case<expected><value>, %case<expected><unit>, %case<description>.raku);
cmp-ok(
create-label(<%s>),
"eq",
"%s %s",
%s,
);
END
example: |-
sub units ( $Ω ) {
given elems gather for $Ω.flip.comb { last if $_ ne 0; .take } {
when 9 { $Ω.substr( 0, *-9 ) ~ ' gigaohms' }
when 6..8 { $Ω.substr( 0, *-6 ) ~ ' megaohms' }
when 3..5 { $Ω.substr( 0, *-3 ) ~ ' kiloohms' }
default { $Ω ~ ' ohms' }
}
}
sub create-label ( *@colors ) is export {
given <black brown red orange yellow green blue violet grey white>.antipairs.Hash{ @colors[ ^ 3 ] } {
units Int.new: [~] .[ ^ 2 ].Slip, 0 x .[ 2 ]
}
}
stub: |-
sub create-label ( *@colors ) is export {
}