trackler 2.0.8.28 → 2.0.8.29
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/common/CONTRIBUTING.md +4 -1
- data/common/README.md +52 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/ecmascript/config.json +7 -0
- data/tracks/ecmascript/exercises/perfect-numbers/example.js +68 -0
- data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +89 -0
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +28 -0
- data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +75 -0
- data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +1 -1
- data/tracks/erlang/exercises/all-your-base/src/all_your_base.app.src +1 -1
- data/tracks/erlang/exercises/allergies/src/allergies.app.src +1 -1
- data/tracks/erlang/exercises/anagram/src/anagram.app.src +1 -1
- data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +1 -1
- data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +1 -1
- data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +1 -1
- data/tracks/erlang/exercises/bob/src/bob.app.src +1 -1
- data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +1 -1
- data/tracks/erlang/exercises/clock/src/clock.app.src +1 -1
- data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +1 -1
- data/tracks/erlang/exercises/etl/src/etl.app.src +1 -1
- data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +1 -1
- data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +1 -1
- data/tracks/erlang/exercises/grains/src/grains.app.src +1 -1
- data/tracks/erlang/exercises/hamming/src/hamming.app.src +1 -1
- data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +1 -1
- data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +1 -1
- data/tracks/erlang/exercises/leap/src/leap.app.src +1 -1
- data/tracks/erlang/exercises/luhn/src/luhn.app.src +1 -1
- data/tracks/erlang/exercises/meetup/src/meetup.app.src +1 -1
- data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +1 -1
- data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +1 -1
- data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +1 -1
- data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +1 -1
- data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +1 -1
- data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +1 -1
- data/tracks/erlang/exercises/rotational-cipher/src/rotational_cipher.app.src +1 -1
- data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +1 -1
- data/tracks/erlang/exercises/series/src/series.app.src +1 -1
- data/tracks/erlang/exercises/space-age/src/space_age.app.src +1 -1
- data/tracks/erlang/exercises/strain/src/strain.app.src +1 -1
- data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +1 -1
- data/tracks/erlang/exercises/triangle/src/triangle.app.src +1 -1
- data/tracks/erlang/exercises/word-count/src/word_count.app.src +1 -1
- data/tracks/erlang/exercises/zipper/src/zipper.app.src +1 -1
- data/tracks/go/exercises/hello-world/hello_world.go +10 -1
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/src/LinkedList.hs +1 -0
- data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +1 -1
- data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +37 -1
- data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +13 -6
- data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +21 -13
- data/tracks/objective-c/exercises/atbash-cipher/AtbashCipherExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongTest.m +4 -4
- data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +1 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +2 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +12 -25
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +32 -80
- data/tracks/objective-c/exercises/sublist/SublistTest.m +47 -70
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -0
- data/tracks/perl6/exercises/allergies/Example.pm +3 -1
- data/tracks/perl6/exercises/allergies/allergies.t +187 -137
- data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -0
- data/tracks/perl6/exercises/anagram/Example.pm +15 -15
- data/tracks/perl6/exercises/anagram/anagram.t +164 -15
- data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -0
- data/tracks/perl6/exercises/atbash-cipher/Example.pm +2 -0
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +109 -86
- data/tracks/perl6/exercises/grains/Example.pm +10 -9
- data/tracks/perl6/exercises/grains/Grains.pm6 +1 -0
- data/tracks/perl6/exercises/grains/grains.t +126 -18
- data/tracks/perl6/exercises/leap/Example.pm +9 -9
- data/tracks/perl6/exercises/leap/Leap.pm6 +4 -0
- data/tracks/perl6/exercises/leap/leap.t +61 -17
- data/tracks/perl6/exercises/phone-number/Example.pm +4 -28
- data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +4 -0
- data/tracks/perl6/exercises/phone-number/phone-number.t +102 -65
- data/tracks/perl6/exercises/raindrops/Example.pm +10 -8
- data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +4 -0
- data/tracks/perl6/exercises/raindrops/raindrops.t +153 -20
- data/tracks/perl6/exercises/rna-transcription/Example.pm +5 -7
- data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +4 -0
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +107 -11
- data/tracks/perl6/exercises/scrabble-score/Example.pm +14 -19
- data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +4 -0
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +106 -15
- data/tracks/perl6/exercises/space-age/Example.pm +29 -13
- data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +22 -0
- data/tracks/perl6/exercises/space-age/space-age.t +90 -52
- data/tracks/perl6/exercises/word-count/Example.pm +4 -8
- data/tracks/perl6/exercises/word-count/WordCount.pm6 +4 -0
- data/tracks/perl6/exercises/word-count/word-count.t +149 -16
- data/tracks/perl6/exercises/wordy/Example.pm +13 -13
- data/tracks/perl6/exercises/wordy/Wordy.pm6 +4 -0
- data/tracks/perl6/exercises/wordy/wordy.t +140 -97
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/atbash-cipher/bower.json +18 -0
- data/tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs +41 -0
- data/tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs +4 -0
- data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +64 -0
- data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +2 -0
- data/tracks/swift/exercises/grade-school/Tests/GradeSchoolTests/GradeSchoolTests.swift +1 -1
- metadata +22 -2
@@ -1,30 +1,6 @@
|
|
1
|
-
|
1
|
+
unit module Phone:ver<1>;
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
sub clean-number ($number is copy) is export {
|
4
|
+
$number ~~ /<:L>/ ?? return Nil !! $number ~~ s:g/<:!Nd>//;
|
5
|
+
$number ~~ /^ 1? (<:Nd> ** 10) $/ ?? ~$0 !! Nil;
|
6
6
|
}
|
7
|
-
|
8
|
-
class Phone is export {
|
9
|
-
has $.number;
|
10
|
-
|
11
|
-
method new (:$number!) {
|
12
|
-
my $validated = $number;
|
13
|
-
$validated ~~ s:g/<:!Decimal_Number>//;
|
14
|
-
$validated ~~ /^ 1? (\d ** 10) $/ ?? ($validated = ~$0) !! X::Phone::Invalid.new(payload => $number).throw;
|
15
|
-
self.bless(number => $validated);
|
16
|
-
}
|
17
|
-
|
18
|
-
method area-code {
|
19
|
-
$!number ~~ /\d**3/ and return ~$/;
|
20
|
-
}
|
21
|
-
|
22
|
-
method pretty {
|
23
|
-
$!number ~~ /
|
24
|
-
$<area-code> = \d**3
|
25
|
-
$<central-office-code> = \d**3
|
26
|
-
$<station-number> = \d**4
|
27
|
-
/ and return "($<area-code>) $<central-office-code>-$<station-number>";
|
28
|
-
}
|
29
|
-
}
|
30
|
-
|
@@ -1,84 +1,121 @@
|
|
1
1
|
#!/usr/bin/env perl6
|
2
2
|
use v6;
|
3
3
|
use Test;
|
4
|
+
use lib my $dir = $?FILE.IO.dirname;
|
4
5
|
use JSON::Tiny;
|
5
|
-
use lib $?FILE.IO.dirname;
|
6
6
|
|
7
|
-
|
8
|
-
my $
|
9
|
-
|
10
|
-
|
7
|
+
my $exercise = 'Phone';
|
8
|
+
my $version = v1;
|
9
|
+
my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
|
10
|
+
plan 13;
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
plan 3;
|
15
|
-
ok Phone.can('number'), 'can Phone.number';
|
16
|
-
ok Phone.can('area-code'), 'can Phone.area-code';
|
17
|
-
ok Phone.can('pretty'), 'can Phone.pretty';
|
18
|
-
} or fail 'Missing method(s).';
|
12
|
+
use-ok $module or bail-out;
|
13
|
+
require ::($module);
|
19
14
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
is $phone.pretty, .<pretty>, "pretty $msg";
|
15
|
+
if ::($exercise).^ver !~~ $version {
|
16
|
+
warn "\nExercise version mismatch. Further tests may fail!"
|
17
|
+
~ "\n$exercise is $(::($exercise).^ver.gist). "
|
18
|
+
~ "Test is $($version.gist).\n";
|
19
|
+
bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
|
26
20
|
}
|
27
21
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
my @subs;
|
23
|
+
BEGIN { @subs = <&clean-number> };
|
24
|
+
subtest 'Subroutine(s)', {
|
25
|
+
plan 1;
|
26
|
+
eval-lives-ok "use $module; ::('$_').defined or die '$_ is not defined.'", $_ for @subs;
|
27
|
+
} or bail-out 'All subroutines must be defined and exported.';
|
28
|
+
require ::($module) @subs.eager;
|
29
|
+
|
30
|
+
for @(my $c-data.<cases>.[0].<cases>) {
|
31
|
+
if .<expected> {
|
32
|
+
is clean-number(.<phrase>), |.<expected description>;
|
33
|
+
} else {
|
34
|
+
nok clean-number(.<phrase>), .<description>;
|
35
|
+
}
|
32
36
|
}
|
33
37
|
|
38
|
+
if %*ENV<EXERCISM> && (my $c-data-file = "$dir/../../x-common/exercises/{$dir.IO.basename}/canonical-data.json".IO.resolve) ~~ :f {
|
39
|
+
is-deeply $c-data, from-json($c-data-file.slurp), 'canonical-data'
|
40
|
+
} else { skip }
|
41
|
+
|
34
42
|
done-testing;
|
35
43
|
|
36
44
|
INIT {
|
37
|
-
|
45
|
+
$c-data := from-json 「
|
38
46
|
{
|
39
|
-
"
|
40
|
-
|
41
|
-
|
42
|
-
"number": "1234567890",
|
43
|
-
"area-code": "123",
|
44
|
-
"pretty": "(123) 456-7890",
|
45
|
-
"test": "10 digit integer"
|
46
|
-
},
|
47
|
-
{
|
48
|
-
"input": "+1 (234) 555-6789",
|
49
|
-
"number": "2345556789",
|
50
|
-
"area-code": "234",
|
51
|
-
"pretty": "(234) 555-6789",
|
52
|
-
"test": "11 digit formatted number"
|
53
|
-
},
|
54
|
-
{
|
55
|
-
"input": "1.379.555.2468",
|
56
|
-
"number": "3795552468",
|
57
|
-
"area-code": "379",
|
58
|
-
"pretty": "(379) 555-2468",
|
59
|
-
"test": "11 digit number containing separators"
|
60
|
-
}
|
61
|
-
],
|
62
|
-
"invalid": [
|
63
|
-
{
|
64
|
-
"input": "",
|
65
|
-
"test": "empty input"
|
66
|
-
},
|
67
|
-
{
|
68
|
-
"input": "13579",
|
69
|
-
"test": "5 digit number"
|
70
|
-
},
|
71
|
-
{
|
72
|
-
"input": "123456789011",
|
73
|
-
"test": "12 digit number"
|
74
|
-
},
|
75
|
-
{
|
76
|
-
"input": "+2 (468) 555-1379",
|
77
|
-
"test": "11 digit number not beginning with 1"
|
78
|
-
},
|
47
|
+
"exercise": "phone-number",
|
48
|
+
"version": "1.0.2",
|
49
|
+
"cases": [
|
79
50
|
{
|
80
|
-
"
|
81
|
-
"
|
51
|
+
"description": "Cleanup user-entered phone numbers",
|
52
|
+
"comments": [
|
53
|
+
" Returns the cleaned phone number if given number is valid, "
|
54
|
+
, " else returns nil. Note that number is not formatted, "
|
55
|
+
, " just a 10-digit number is returned. "
|
56
|
+
],
|
57
|
+
"cases": [
|
58
|
+
{
|
59
|
+
"description": "cleans the number",
|
60
|
+
"property": "clean",
|
61
|
+
"phrase": "(123) 456-7890",
|
62
|
+
"expected": "1234567890"
|
63
|
+
},
|
64
|
+
{
|
65
|
+
"description": "cleans numbers with dots",
|
66
|
+
"property": "clean",
|
67
|
+
"phrase": "123.456.7890",
|
68
|
+
"expected": "1234567890"
|
69
|
+
},
|
70
|
+
{
|
71
|
+
"description": "cleans numbers with multiple spaces",
|
72
|
+
"property": "clean",
|
73
|
+
"phrase": "123 456 7890 ",
|
74
|
+
"expected": "1234567890"
|
75
|
+
},
|
76
|
+
{
|
77
|
+
"description": "invalid when 9 digits",
|
78
|
+
"property": "clean",
|
79
|
+
"phrase": "123456789",
|
80
|
+
"expected": null
|
81
|
+
},
|
82
|
+
{
|
83
|
+
"description": "invalid when 11 digits does not start with a 1",
|
84
|
+
"property": "clean",
|
85
|
+
"phrase": "21234567890",
|
86
|
+
"expected": null
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"description": "valid when 11 digits and starting with 1",
|
90
|
+
"property": "clean",
|
91
|
+
"phrase": "11234567890",
|
92
|
+
"expected": "1234567890"
|
93
|
+
},
|
94
|
+
{
|
95
|
+
"description": "invalid when more than 11 digits",
|
96
|
+
"property": "clean",
|
97
|
+
"phrase": "321234567890",
|
98
|
+
"expected": null
|
99
|
+
},
|
100
|
+
{
|
101
|
+
"description": "invalid with letters",
|
102
|
+
"property": "clean",
|
103
|
+
"phrase": "123-abc-7890",
|
104
|
+
"expected": null
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"description": "invalid with punctuations",
|
108
|
+
"property": "clean",
|
109
|
+
"phrase": "123-@:!-7890",
|
110
|
+
"expected": null
|
111
|
+
},
|
112
|
+
{
|
113
|
+
"description": "invalid with right number of digits but letters mixed in",
|
114
|
+
"property": "clean",
|
115
|
+
"phrase": "1a2b3c4d5e6f7g8h9i0j",
|
116
|
+
"expected": null
|
117
|
+
}
|
118
|
+
]
|
82
119
|
}
|
83
120
|
]
|
84
121
|
}
|
@@ -1,9 +1,11 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
}
|
1
|
+
unit module Raindrops:ver<1>;
|
2
|
+
|
3
|
+
sub convert (Int:D $num --> Str:D) is export {
|
4
|
+
my $str = '';
|
5
|
+
given $num {
|
6
|
+
when * %% 3 {$str ~= 'Pling'; proceed}
|
7
|
+
when * %% 5 {$str ~= 'Plang'; proceed}
|
8
|
+
when * %% 7 {$str ~= 'Plong'}
|
9
|
+
}
|
10
|
+
return $str ?? $str !! $num.Str;
|
9
11
|
}
|
@@ -1,28 +1,161 @@
|
|
1
1
|
#!/usr/bin/env perl6
|
2
2
|
use v6;
|
3
3
|
use Test;
|
4
|
-
use lib
|
4
|
+
use lib my $dir = $?FILE.IO.dirname;
|
5
|
+
use JSON::Tiny;
|
5
6
|
|
6
|
-
|
7
|
-
my $
|
8
|
-
|
9
|
-
|
7
|
+
my $exercise = 'Raindrops';
|
8
|
+
my $version = v1;
|
9
|
+
my $module = %*ENV<EXERCISM> ?? 'Example' !! $exercise;
|
10
|
+
plan 21;
|
10
11
|
|
11
|
-
ok
|
12
|
+
use-ok $module or bail-out;
|
13
|
+
require ::($module);
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
if ::($exercise).^ver !~~ $version {
|
16
|
+
warn "\nExercise version mismatch. Further tests may fail!"
|
17
|
+
~ "\n$exercise is $(::($exercise).^ver.gist). "
|
18
|
+
~ "Test is $($version.gist).\n";
|
19
|
+
bail-out 'Example version must match test version.' if %*ENV<EXERCISM>;
|
20
|
+
}
|
21
|
+
|
22
|
+
my @subs;
|
23
|
+
BEGIN { @subs = <&convert> };
|
24
|
+
subtest 'Subroutine(s)', {
|
25
|
+
plan 1;
|
26
|
+
eval-lives-ok "use $module; ::('$_').defined or die '$_ is not defined.'", $_ for @subs;
|
27
|
+
} or bail-out 'All subroutines must be defined and exported.';
|
28
|
+
require ::($module) @subs.eager;
|
29
|
+
|
30
|
+
for @(my $c-data.<cases>) {
|
31
|
+
subtest {
|
32
|
+
plan 2;
|
33
|
+
is .<number>.&convert, |.<expected description>;
|
34
|
+
isa-ok .<number>.&convert, Str;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
if %*ENV<EXERCISM> && (my $c-data-file = "$dir/../../x-common/exercises/{$dir.IO.basename}/canonical-data.json".IO.resolve) ~~ :f {
|
39
|
+
is-deeply $c-data, from-json($c-data-file.slurp), 'canonical-data'
|
40
|
+
} else { skip }
|
41
|
+
|
42
|
+
done-testing;
|
17
43
|
|
18
|
-
|
19
|
-
|
20
|
-
|
44
|
+
INIT {
|
45
|
+
$c-data := from-json 「
|
46
|
+
{
|
47
|
+
"exercise": "raindrops",
|
48
|
+
"version": "1.0.0",
|
49
|
+
"cases": [
|
50
|
+
{
|
51
|
+
"description": "the sound for 1 is 1",
|
52
|
+
"property": "convert",
|
53
|
+
"number": 1,
|
54
|
+
"expected": "1"
|
55
|
+
},
|
56
|
+
{
|
57
|
+
"description": "the sound for 3 is Pling",
|
58
|
+
"property": "convert",
|
59
|
+
"number": 3,
|
60
|
+
"expected": "Pling"
|
61
|
+
},
|
62
|
+
{
|
63
|
+
"description": "the sound for 5 is Plang",
|
64
|
+
"property": "convert",
|
65
|
+
"number": 5,
|
66
|
+
"expected": "Plang"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"description": "the sound for 7 is Plong",
|
70
|
+
"property": "convert",
|
71
|
+
"number": 7,
|
72
|
+
"expected": "Plong"
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"description": "the sound for 6 is Pling as it has a factor 3",
|
76
|
+
"property": "convert",
|
77
|
+
"number": 6,
|
78
|
+
"expected": "Pling"
|
79
|
+
},
|
80
|
+
{
|
81
|
+
"description": "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base",
|
82
|
+
"property": "convert",
|
83
|
+
"number": 8,
|
84
|
+
"expected": "8"
|
85
|
+
},
|
86
|
+
{
|
87
|
+
"description": "the sound for 9 is Pling as it has a factor 3",
|
88
|
+
"property": "convert",
|
89
|
+
"number": 9,
|
90
|
+
"expected": "Pling"
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"description": "the sound for 10 is Plang as it has a factor 5",
|
94
|
+
"property": "convert",
|
95
|
+
"number": 10,
|
96
|
+
"expected": "Plang"
|
97
|
+
},
|
98
|
+
{
|
99
|
+
"description": "the sound for 14 is Plong as it has a factor of 7",
|
100
|
+
"property": "convert",
|
101
|
+
"number": 14,
|
102
|
+
"expected": "Plong"
|
103
|
+
},
|
104
|
+
{
|
105
|
+
"description": "the sound for 15 is PlingPlang as it has factors 3 and 5",
|
106
|
+
"property": "convert",
|
107
|
+
"number": 15,
|
108
|
+
"expected": "PlingPlang"
|
109
|
+
},
|
110
|
+
{
|
111
|
+
"description": "the sound for 21 is PlingPlong as it has factors 3 and 7",
|
112
|
+
"property": "convert",
|
113
|
+
"number": 21,
|
114
|
+
"expected": "PlingPlong"
|
115
|
+
},
|
116
|
+
{
|
117
|
+
"description": "the sound for 25 is Plang as it has a factor 5",
|
118
|
+
"property": "convert",
|
119
|
+
"number": 25,
|
120
|
+
"expected": "Plang"
|
121
|
+
},
|
122
|
+
{
|
123
|
+
"description": "the sound for 27 is Pling as it has a factor 3",
|
124
|
+
"property": "convert",
|
125
|
+
"number": 27,
|
126
|
+
"expected": "Pling"
|
127
|
+
},
|
128
|
+
{
|
129
|
+
"description": "the sound for 35 is PlangPlong as it has factors 5 and 7",
|
130
|
+
"property": "convert",
|
131
|
+
"number": 35,
|
132
|
+
"expected": "PlangPlong"
|
133
|
+
},
|
134
|
+
{
|
135
|
+
"description": "the sound for 49 is Plong as it has a factor 7",
|
136
|
+
"property": "convert",
|
137
|
+
"number": 49,
|
138
|
+
"expected": "Plong"
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"description": "the sound for 52 is 52",
|
142
|
+
"property": "convert",
|
143
|
+
"number": 52,
|
144
|
+
"expected": "52"
|
145
|
+
},
|
146
|
+
{
|
147
|
+
"description": "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7",
|
148
|
+
"property": "convert",
|
149
|
+
"number": 105,
|
150
|
+
"expected": "PlingPlangPlong"
|
151
|
+
},
|
152
|
+
{
|
153
|
+
"description": "the sound for 3125 is Plang as it has a factor 5",
|
154
|
+
"property": "convert",
|
155
|
+
"number": 3125,
|
156
|
+
"expected": "Plang"
|
157
|
+
}
|
158
|
+
]
|
159
|
+
}
|
160
|
+
」
|
21
161
|
}
|
22
|
-
is Raindrops.convert($_), 'Pling', "$_ is a factor of 3, not 5 or 7" for @plings;
|
23
|
-
is Raindrops.convert($_), 'Plang', "$_ is a factor of 5, not 3 or 7" for @plangs;
|
24
|
-
is Raindrops.convert($_), 'Plong', "$_ is a factor of 7, not 3 or 5" for @plongs;
|
25
|
-
is Raindrops.convert(15), 'PlingPlang', '15 is a factor of 3 and 5, not 7';
|
26
|
-
is Raindrops.convert(21), 'PlingPlong', '21 is a factor of 3 and 7, not 5';
|
27
|
-
is Raindrops.convert(35), 'PlangPlong', '35 is a factor of 5 and 7, not 3';
|
28
|
-
is Raindrops.convert(105), 'PlingPlangPlong', '105 is a factor of 3, 5 and 7';
|
@@ -1,8 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
'T' => 'A');
|
7
|
-
}
|
1
|
+
unit module RNA:ver<1>;
|
2
|
+
|
3
|
+
sub to-rna ($dna) is export {
|
4
|
+
fail if $dna ~~ /<-[AGCT]>/;
|
5
|
+
$dna.trans(<A G C T> => <U C G A>);
|
8
6
|
}
|