trackler 2.1.0.19 → 2.1.0.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/verify-metadata +1 -1
- data/lib/trackler/implementation.rb +1 -9
- data/lib/trackler/version.rb +1 -1
- data/tracks/go/exercises/tree-building/tree_test.go +1 -1
- data/tracks/haskell/.travis.yml +1 -0
- data/tracks/haskell/bin/test-example +17 -5
- data/tracks/haskell/bin/test-stub +14 -3
- data/tracks/java/exercises/build.gradle +3 -3
- data/tracks/java/exercises/difference-of-squares/src/test/java/DifferenceOfSquaresCalculatorTest.java +1 -1
- data/tracks/javascript/config.json +21 -1
- data/tracks/javascript/exercises/alphametics/alphametics.spec.js +95 -0
- data/tracks/javascript/exercises/alphametics/example.js +107 -0
- data/tracks/perl6/bin/README.md +5 -3
- data/tracks/perl6/docs/LEARNING.md +7 -0
- data/tracks/r/exercises/anagram/test_anagram.R +33 -52
- data/tracks/r/exercises/bob/test_bob.R +52 -73
- data/tracks/r/exercises/difference-of-squares/test_difference-of-squares.R +1 -2
- data/tracks/r/exercises/grains/test_grains.R +1 -1
- data/tracks/r/exercises/hamming/test_hamming.R +1 -1
- data/tracks/r/exercises/hello-world/test_hello-world.R +1 -1
- data/tracks/r/exercises/isogram/test_isogram.R +1 -1
- data/tracks/r/exercises/largest-series-product/test_largest-series-product.R +8 -8
- data/tracks/r/exercises/leap/test_leap.R +1 -1
- data/tracks/r/exercises/luhn/test_luhn.R +1 -1
- data/tracks/r/exercises/pascals-triangle/test_pascals-triangle.R +1 -1
- data/tracks/r/exercises/perfect-numbers/test_perfect-numbers.R +1 -1
- data/tracks/r/exercises/phone-number/test_phone-number.R +1 -1
- data/tracks/r/exercises/prime-factors/test_prime-factors.R +16 -21
- data/tracks/r/exercises/raindrops/test_raindrops.R +1 -1
- data/tracks/r/exercises/rna-transcription/test_rna-transcription.R +1 -1
- data/tracks/r/exercises/rotational-cipher/test_rotational-cipher.R +1 -1
- data/tracks/r/exercises/scrabble-score/test_scrabble-score.R +1 -1
- data/tracks/r/exercises/secret-handshake/test_secret-handshake.R +1 -1
- data/tracks/r/exercises/sieve/test_sieve.R +18 -17
- data/tracks/r/exercises/space-age/test_space-age.R +2 -2
- data/tracks/r/exercises/sum-of-multiples/test_sum-of-multiples.R +11 -11
- data/tracks/r/exercises/tournament/test_tournament.R +142 -107
- data/tracks/r/exercises/word-count/test_word-count.R +38 -17
- data/tracks/vimscript/config.json +23 -0
- data/tracks/vimscript/exercises/anagram/anagram.vader +95 -0
- data/tracks/vimscript/exercises/anagram/anagram.vim +19 -0
- data/tracks/vimscript/exercises/anagram/example.vim +18 -0
- data/tracks/vimscript/exercises/difference-of-squares/difference_of_squares.vader +35 -0
- data/tracks/vimscript/exercises/difference-of-squares/difference_of_squares.vim +24 -0
- data/tracks/vimscript/exercises/difference-of-squares/example.vim +19 -0
- data/tracks/vimscript/exercises/raindrops/example.vim +9 -0
- data/tracks/vimscript/exercises/raindrops/raindrops.vader +53 -0
- data/tracks/vimscript/exercises/raindrops/raindrops.vim +18 -0
- data/tracks/vimscript/exercises/rna-transcription/example.vim +3 -0
- data/tracks/vimscript/exercises/rna-transcription/rna_transcription.vader +23 -0
- data/tracks/vimscript/exercises/rna-transcription/rna_transcription.vim +20 -0
- metadata +16 -2
data/tracks/perl6/bin/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
The `exercise-gen.pl6` file can be used in the following ways:
|
2
|
-
* From within the directory of the exercise you wish to generate a test for.
|
3
|
-
* With arguments specifying which exercises you want to generate tests for
|
4
|
-
e.g. `./exercise-gen.pl6 hello-world leap
|
2
|
+
* From within the directory of the exercise you wish to generate a test for. [showterm example](http://showterm.io/cc7ddb7b23bb73e784d7d)
|
3
|
+
* With arguments specifying which exercises you want to generate tests for
|
4
|
+
e.g. `./exercise-gen.pl6 hello-world leap`. [showterm example](http://showterm.io/54d5cf196eb45a0e40640)
|
5
5
|
* With the argument `--all` to run the generator for all exercises.
|
6
6
|
i.e `./exercise-gen.pl6 --all`
|
7
7
|
|
@@ -30,3 +30,5 @@ tests: |
|
|
30
30
|
```
|
31
31
|
|
32
32
|
You must have `Template::Mustache` and `YAMLish` to run `exercise-gen.pl6`.
|
33
|
+
|
34
|
+
Note (2017-05-22): [YAMLish](http://modules.perl6.org/dist/YAMLish) is not yet feature complete, so some valid YAML files may not parse.
|
@@ -6,3 +6,10 @@ The [Resources](https://perl6.org/resources/) page on [perl6.org](https://perl6.
|
|
6
6
|
* [Learn Perl 6 in Y minutes](https://learnxinyminutes.com/docs/perl6/)
|
7
7
|
* [Perl 6 tutorials](https://github.com/perlpilot/perl6-docs)
|
8
8
|
* [SixFix](http://sixfix.nigelhamilton.com/) a weekly dose of Perl 6 delivered by email
|
9
|
+
|
10
|
+
## Perl 6 from Other Languages - Nutshell
|
11
|
+
|
12
|
+
* [Perl 5](https://docs.perl6.org/language/5to6-nutshell)
|
13
|
+
* [Haskell](https://docs.perl6.org/language/haskell-to-p6)
|
14
|
+
* [Python](https://docs.perl6.org/language/py-nutshell)
|
15
|
+
* [Ruby](https://docs.perl6.org/language/rb-nutshell)
|
@@ -1,164 +1,145 @@
|
|
1
|
-
source(
|
1
|
+
source("./anagram.R")
|
2
2
|
library(testthat)
|
3
3
|
|
4
4
|
test_that("no matches", {
|
5
5
|
subject <- "diaper"
|
6
|
-
candidates <- c("hello","world","zombies","pants")
|
6
|
+
candidates <- c("hello", "world", "zombies", "pants")
|
7
7
|
expect_equal(anagram(subject, candidates),
|
8
|
-
|
9
|
-
)
|
8
|
+
c())
|
10
9
|
})
|
11
10
|
|
12
11
|
test_that("detects simple anagram", {
|
13
12
|
subject <- "ant"
|
14
|
-
candidates <- c("tan","stand","at")
|
13
|
+
candidates <- c("tan", "stand", "at")
|
15
14
|
expect_equal(anagram(subject, candidates),
|
16
|
-
|
17
|
-
)
|
15
|
+
c("tan"))
|
18
16
|
})
|
19
17
|
|
20
18
|
test_that("does not detect false positives", {
|
21
19
|
subject <- "galea"
|
22
20
|
candidates <- c("eagle")
|
23
21
|
expect_equal(anagram(subject, candidates),
|
24
|
-
|
25
|
-
)
|
22
|
+
c())
|
26
23
|
})
|
27
24
|
|
28
25
|
test_that("detects multiple anagrams", {
|
29
26
|
subject <- "master"
|
30
|
-
candidates <- c("stream","pigeon","maters")
|
27
|
+
candidates <- c("stream", "pigeon", "maters")
|
31
28
|
expect_equal(anagram(subject, candidates),
|
32
|
-
|
33
|
-
)
|
29
|
+
c("stream", "maters"))
|
34
30
|
})
|
35
31
|
|
36
32
|
test_that("does not detect anagram subsets", {
|
37
33
|
subject <- "good"
|
38
|
-
candidates <- c("dog","goody")
|
34
|
+
candidates <- c("dog", "goody")
|
39
35
|
expect_equal(anagram(subject, candidates),
|
40
|
-
|
41
|
-
)
|
36
|
+
c())
|
42
37
|
})
|
43
38
|
|
44
39
|
test_that("detects anagram", {
|
45
40
|
subject <- "listen"
|
46
|
-
candidates <- c("enlists","google","inlets","banana")
|
41
|
+
candidates <- c("enlists", "google", "inlets", "banana")
|
47
42
|
expect_equal(anagram(subject, candidates),
|
48
|
-
|
49
|
-
)
|
43
|
+
c("inlets"))
|
50
44
|
})
|
51
45
|
|
52
46
|
test_that("detects multiple anagrams", {
|
53
47
|
subject <- "allergy"
|
54
|
-
candidates <-
|
48
|
+
candidates <-
|
49
|
+
c("gallery", "ballerina", "regally", "clergy", "largely", "leading")
|
55
50
|
expect_equal(anagram(subject, candidates),
|
56
|
-
|
57
|
-
)
|
51
|
+
c("gallery", "regally", "largely"))
|
58
52
|
})
|
59
53
|
|
60
54
|
test_that("does not detect indentical words", {
|
61
55
|
subject <- "corn"
|
62
|
-
candidates <- c("corn","dark","Corn","rank","CORN","cron","park")
|
56
|
+
candidates <- c("corn", "dark", "Corn", "rank", "CORN", "cron", "park")
|
63
57
|
expect_equal(anagram(subject, candidates),
|
64
|
-
|
65
|
-
)
|
58
|
+
c("cron"))
|
66
59
|
})
|
67
60
|
|
68
61
|
test_that("does not detect non-anagrams with identical checksum", {
|
69
62
|
subject <- "mass"
|
70
63
|
candidates <- c("last")
|
71
64
|
expect_equal(anagram(subject, candidates),
|
72
|
-
|
73
|
-
)
|
65
|
+
c())
|
74
66
|
})
|
75
67
|
|
76
68
|
test_that("detects anagrams case-insensitively", {
|
77
69
|
subject <- "Orchestra"
|
78
|
-
candidates <- c("cashregister","Carthorse","radishes")
|
70
|
+
candidates <- c("cashregister", "Carthorse", "radishes")
|
79
71
|
expect_equal(anagram(subject, candidates),
|
80
|
-
|
81
|
-
)
|
72
|
+
c("Carthorse"))
|
82
73
|
})
|
83
74
|
|
84
75
|
test_that("detects anagrams using case-insensitive subject", {
|
85
76
|
subject <- "Orchestra"
|
86
|
-
candidates <- c("cashregister","carthorse","radishes")
|
77
|
+
candidates <- c("cashregister", "carthorse", "radishes")
|
87
78
|
expect_equal(anagram(subject, candidates),
|
88
|
-
|
89
|
-
)
|
79
|
+
c("carthorse"))
|
90
80
|
})
|
91
81
|
|
92
82
|
test_that("detects anagrams using case-insensitve possible matches", {
|
93
83
|
subject <- "orchestra"
|
94
|
-
candidates <- c("cashregister","Carthorse","radishes")
|
84
|
+
candidates <- c("cashregister", "Carthorse", "radishes")
|
95
85
|
expect_equal(anagram(subject, candidates),
|
96
|
-
|
97
|
-
)
|
86
|
+
c("Carthorse"))
|
98
87
|
})
|
99
88
|
|
100
89
|
test_that("does not detect a word as its own anagram", {
|
101
90
|
subject <- "banana"
|
102
91
|
candidates <- c("Banana")
|
103
92
|
expect_equal(anagram(subject, candidates),
|
104
|
-
|
105
|
-
)
|
93
|
+
c())
|
106
94
|
})
|
107
95
|
|
108
96
|
test_that("does not detect a anagram if the original word is repeated", {
|
109
97
|
subject <- "go"
|
110
98
|
candidates <- c("go Go GO")
|
111
99
|
expect_equal(anagram(subject, candidates),
|
112
|
-
|
113
|
-
)
|
100
|
+
c())
|
114
101
|
})
|
115
102
|
|
116
103
|
test_that("anagrams must use all letters exactly once", {
|
117
104
|
subject <- "tapper"
|
118
105
|
candidates <- c("patter")
|
119
106
|
expect_equal(anagram(subject, candidates),
|
120
|
-
|
121
|
-
)
|
107
|
+
c())
|
122
108
|
})
|
123
109
|
|
124
110
|
test_that("eliminates anagrams with the same checksum", {
|
125
111
|
subject <- "mass"
|
126
112
|
candidates <- c("last")
|
127
113
|
expect_equal(anagram(subject, candidates),
|
128
|
-
|
129
|
-
)
|
114
|
+
c())
|
130
115
|
})
|
131
116
|
|
132
117
|
test_that("detects unicode anagrams", {
|
133
118
|
subject <- "ΑΒΓ"
|
134
|
-
candidates <- c("ΒΓΑ","ΒΓΔ","γβα")
|
119
|
+
candidates <- c("ΒΓΑ", "ΒΓΔ", "γβα")
|
135
120
|
expect_equal(anagram(subject, candidates),
|
136
|
-
|
137
|
-
)
|
121
|
+
c("ΒΓΑ", "γβα"))
|
138
122
|
})
|
139
123
|
|
140
124
|
test_that("eliminates misleading unicode anagrams", {
|
141
125
|
subject <- "ΑΒΓ"
|
142
126
|
candidates <- c("ABΓ")
|
143
127
|
expect_equal(anagram(subject, candidates),
|
144
|
-
|
145
|
-
)
|
128
|
+
c())
|
146
129
|
})
|
147
130
|
|
148
131
|
test_that("capital word is not own anagram", {
|
149
132
|
subject <- "BANANA"
|
150
133
|
candidates <- c("Banana")
|
151
134
|
expect_equal(anagram(subject, candidates),
|
152
|
-
|
153
|
-
)
|
135
|
+
c())
|
154
136
|
})
|
155
137
|
|
156
138
|
test_that("anagrams must use all letters exactly once", {
|
157
139
|
subject <- "patter"
|
158
140
|
candidates <- c("tapper")
|
159
141
|
expect_equal(anagram(subject, candidates),
|
160
|
-
|
161
|
-
)
|
142
|
+
c())
|
162
143
|
})
|
163
144
|
|
164
145
|
print("All tests passed!")
|
@@ -1,197 +1,176 @@
|
|
1
|
-
source(
|
1
|
+
source("./bob.R")
|
2
2
|
library(testthat)
|
3
3
|
|
4
4
|
test_that("stating something", {
|
5
5
|
input <- "Tom-ay-to, tom-aaaah-to."
|
6
6
|
expect_equal(bob(input),
|
7
|
-
|
8
|
-
)
|
7
|
+
"Whatever.")
|
9
8
|
})
|
10
9
|
|
11
10
|
test_that("shouting", {
|
12
11
|
input <- "WATCH OUT!"
|
13
12
|
expect_equal(bob(input),
|
14
|
-
|
15
|
-
)
|
13
|
+
"Whoa, chill out!")
|
16
14
|
})
|
17
15
|
|
18
16
|
test_that("shouting gibberish", {
|
19
17
|
input <- "FCECDFCAAB"
|
20
18
|
expect_equal(bob(input),
|
21
|
-
|
22
|
-
)
|
19
|
+
"Whoa, chill out!")
|
23
20
|
})
|
24
21
|
|
25
22
|
test_that("asking a question", {
|
26
23
|
input <- "Does this cryogenic chamber make me look fat?"
|
27
24
|
expect_equal(bob(input),
|
28
|
-
|
29
|
-
)
|
25
|
+
"Sure.")
|
30
26
|
})
|
31
27
|
|
32
28
|
test_that("asking a numeric question", {
|
33
29
|
input <- "You are, what, like 15?"
|
34
30
|
expect_equal(bob(input),
|
35
|
-
|
36
|
-
)
|
31
|
+
"Sure.")
|
37
32
|
})
|
38
33
|
|
39
34
|
test_that("asking gibberish", {
|
40
35
|
input <- "fffbbcbeab?"
|
41
36
|
expect_equal(bob(input),
|
42
|
-
|
43
|
-
)
|
37
|
+
"Sure.")
|
44
38
|
})
|
45
39
|
|
46
40
|
test_that("talking forcefully", {
|
47
41
|
input <- "Let's go make out behind the gym!"
|
48
42
|
expect_equal(bob(input),
|
49
|
-
|
43
|
+
"Whatever."
|
50
44
|
)
|
51
45
|
})
|
52
|
-
|
53
|
-
test_that("using acronyms in regular speech", {
|
46
|
+
|
47
|
+
test_that("using acronyms in regular speech", {
|
54
48
|
input <- "It's OK if you don't want to go to the DMV."
|
55
49
|
expect_equal(bob(input),
|
56
|
-
|
50
|
+
"Whatever."
|
57
51
|
)
|
58
|
-
})
|
59
|
-
|
60
|
-
test_that("forceful question", {
|
52
|
+
})
|
53
|
+
|
54
|
+
test_that("forceful question", {
|
61
55
|
input <- "WHAT THE HELL WERE YOU THINKING?"
|
62
56
|
expect_equal(bob(input),
|
63
|
-
|
57
|
+
"Whoa, chill out!"
|
64
58
|
)
|
65
|
-
})
|
66
|
-
|
67
|
-
test_that("shouting numbers", {
|
59
|
+
})
|
60
|
+
|
61
|
+
test_that("shouting numbers", {
|
68
62
|
input <- "1, 2, 3 GO!"
|
69
63
|
expect_equal(bob(input),
|
70
|
-
|
64
|
+
"Whoa, chill out!"
|
71
65
|
)
|
72
|
-
})
|
73
|
-
|
74
|
-
test_that("only numbers", {
|
66
|
+
})
|
67
|
+
|
68
|
+
test_that("only numbers", {
|
75
69
|
input <- "1, 2, 3"
|
76
70
|
expect_equal(bob(input),
|
77
|
-
|
71
|
+
"Whatever."
|
78
72
|
)
|
79
|
-
})
|
80
|
-
|
81
|
-
test_that("question with only numbers", {
|
73
|
+
})
|
74
|
+
|
75
|
+
test_that("question with only numbers", {
|
82
76
|
input <- "4?"
|
83
77
|
expect_equal(bob(input),
|
84
|
-
|
78
|
+
"Sure."
|
85
79
|
)
|
86
|
-
})
|
87
|
-
|
88
|
-
test_that("shouting with special characters", {
|
89
|
-
input <- "ZOMG THE
|
90
|
-
|
91
|
-
|
92
|
-
)
|
93
|
-
})
|
80
|
+
})
|
81
|
+
|
82
|
+
test_that("shouting with special characters", {
|
83
|
+
input <- "ZOMG THE % ^ * @#$(*^ ZOMBIES ARE COMING!!11!!1!"
|
84
|
+
expect_equal(bob(input),
|
85
|
+
"Whoa, chill out!")
|
86
|
+
})
|
94
87
|
|
95
88
|
test_that("shouting with umlauts", {
|
96
89
|
input <- "ÜMLÄÜTS!"
|
97
90
|
expect_equal(bob(input),
|
98
|
-
|
99
|
-
)
|
91
|
+
"Whoa, chill out!")
|
100
92
|
})
|
101
93
|
|
102
94
|
test_that("calmly speaking with umlauts", {
|
103
95
|
input <- "ÜMLäÜTS!"
|
104
96
|
expect_equal(bob(input),
|
105
|
-
|
106
|
-
)
|
97
|
+
"Whatever.")
|
107
98
|
})
|
108
99
|
|
109
100
|
test_that("shouting with no exclamation mark", {
|
110
101
|
input <- "I HATE YOU"
|
111
102
|
expect_equal(bob(input),
|
112
|
-
|
113
|
-
)
|
103
|
+
"Whoa, chill out!")
|
114
104
|
})
|
115
105
|
|
116
106
|
test_that("statement containing question mark", {
|
117
107
|
input <- "Ending with ? means a question."
|
118
108
|
expect_equal(bob(input),
|
119
|
-
|
120
|
-
)
|
109
|
+
"Whatever.")
|
121
110
|
})
|
122
111
|
|
123
112
|
test_that("non-letters with question", {
|
124
113
|
input <- ":) ?"
|
125
114
|
expect_equal(bob(input),
|
126
|
-
|
127
|
-
)
|
115
|
+
"Sure.")
|
128
116
|
})
|
129
117
|
|
130
118
|
test_that("prattling on", {
|
131
119
|
input <- "Wait! Hang on. Are you going to be OK?"
|
132
120
|
expect_equal(bob(input),
|
133
|
-
|
134
|
-
)
|
121
|
+
"Sure.")
|
135
122
|
})
|
136
123
|
|
137
124
|
test_that("silence", {
|
138
125
|
input <- ""
|
139
126
|
expect_equal(bob(input),
|
140
|
-
|
141
|
-
)
|
127
|
+
"Fine. Be that way!")
|
142
128
|
})
|
143
129
|
|
144
130
|
test_that("prolonged silence", {
|
145
131
|
input <- " "
|
146
132
|
expect_equal(bob(input),
|
147
|
-
|
148
|
-
)
|
133
|
+
"Fine. Be that way!")
|
149
134
|
})
|
150
135
|
|
151
136
|
test_that("alternate silence", {
|
152
137
|
input <- " "
|
153
138
|
expect_equal(bob(input),
|
154
|
-
|
155
|
-
)
|
139
|
+
"Fine. Be that way!")
|
156
140
|
})
|
157
141
|
|
158
142
|
test_that("multiple line question", {
|
159
143
|
input <- "
|
160
|
-
Does this cryogenic chamber make me look fat?
|
161
|
-
no"
|
144
|
+
Does this cryogenic chamber make me look fat?
|
145
|
+
no"
|
162
146
|
expect_equal(bob(input),
|
163
|
-
|
164
|
-
)
|
147
|
+
"Whatever.")
|
165
148
|
})
|
166
149
|
|
167
150
|
test_that("starting with whitespace", {
|
168
151
|
input <- " hmmmmmmm..."
|
169
152
|
expect_equal(bob(input),
|
170
|
-
|
171
|
-
)
|
153
|
+
"Whatever.")
|
172
154
|
})
|
173
155
|
|
174
156
|
test_that("ending with whitespace", {
|
175
157
|
input <- "Okay if like my spacebar quite a bit? "
|
176
158
|
expect_equal(bob(input),
|
177
|
-
|
178
|
-
)
|
159
|
+
"Sure.")
|
179
160
|
})
|
180
161
|
|
181
162
|
test_that("other whitespace", {
|
182
163
|
input <- "
|
183
|
-
|
184
|
-
|
164
|
+
|
165
|
+
"
|
185
166
|
expect_equal(bob(input),
|
186
|
-
|
187
|
-
)
|
167
|
+
"Fine. Be that way!")
|
188
168
|
})
|
189
169
|
|
190
170
|
test_that("non-question ending with whitespace", {
|
191
171
|
input <- "This is a statement ending with whitespace "
|
192
172
|
expect_equal(bob(input),
|
193
|
-
|
194
|
-
)
|
173
|
+
"Whatever.")
|
195
174
|
})
|
196
175
|
|
197
176
|
print("All tests passed!")
|