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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/bin/verify-metadata +1 -1
  3. data/lib/trackler/implementation.rb +1 -9
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/go/exercises/tree-building/tree_test.go +1 -1
  6. data/tracks/haskell/.travis.yml +1 -0
  7. data/tracks/haskell/bin/test-example +17 -5
  8. data/tracks/haskell/bin/test-stub +14 -3
  9. data/tracks/java/exercises/build.gradle +3 -3
  10. data/tracks/java/exercises/difference-of-squares/src/test/java/DifferenceOfSquaresCalculatorTest.java +1 -1
  11. data/tracks/javascript/config.json +21 -1
  12. data/tracks/javascript/exercises/alphametics/alphametics.spec.js +95 -0
  13. data/tracks/javascript/exercises/alphametics/example.js +107 -0
  14. data/tracks/perl6/bin/README.md +5 -3
  15. data/tracks/perl6/docs/LEARNING.md +7 -0
  16. data/tracks/r/exercises/anagram/test_anagram.R +33 -52
  17. data/tracks/r/exercises/bob/test_bob.R +52 -73
  18. data/tracks/r/exercises/difference-of-squares/test_difference-of-squares.R +1 -2
  19. data/tracks/r/exercises/grains/test_grains.R +1 -1
  20. data/tracks/r/exercises/hamming/test_hamming.R +1 -1
  21. data/tracks/r/exercises/hello-world/test_hello-world.R +1 -1
  22. data/tracks/r/exercises/isogram/test_isogram.R +1 -1
  23. data/tracks/r/exercises/largest-series-product/test_largest-series-product.R +8 -8
  24. data/tracks/r/exercises/leap/test_leap.R +1 -1
  25. data/tracks/r/exercises/luhn/test_luhn.R +1 -1
  26. data/tracks/r/exercises/pascals-triangle/test_pascals-triangle.R +1 -1
  27. data/tracks/r/exercises/perfect-numbers/test_perfect-numbers.R +1 -1
  28. data/tracks/r/exercises/phone-number/test_phone-number.R +1 -1
  29. data/tracks/r/exercises/prime-factors/test_prime-factors.R +16 -21
  30. data/tracks/r/exercises/raindrops/test_raindrops.R +1 -1
  31. data/tracks/r/exercises/rna-transcription/test_rna-transcription.R +1 -1
  32. data/tracks/r/exercises/rotational-cipher/test_rotational-cipher.R +1 -1
  33. data/tracks/r/exercises/scrabble-score/test_scrabble-score.R +1 -1
  34. data/tracks/r/exercises/secret-handshake/test_secret-handshake.R +1 -1
  35. data/tracks/r/exercises/sieve/test_sieve.R +18 -17
  36. data/tracks/r/exercises/space-age/test_space-age.R +2 -2
  37. data/tracks/r/exercises/sum-of-multiples/test_sum-of-multiples.R +11 -11
  38. data/tracks/r/exercises/tournament/test_tournament.R +142 -107
  39. data/tracks/r/exercises/word-count/test_word-count.R +38 -17
  40. data/tracks/vimscript/config.json +23 -0
  41. data/tracks/vimscript/exercises/anagram/anagram.vader +95 -0
  42. data/tracks/vimscript/exercises/anagram/anagram.vim +19 -0
  43. data/tracks/vimscript/exercises/anagram/example.vim +18 -0
  44. data/tracks/vimscript/exercises/difference-of-squares/difference_of_squares.vader +35 -0
  45. data/tracks/vimscript/exercises/difference-of-squares/difference_of_squares.vim +24 -0
  46. data/tracks/vimscript/exercises/difference-of-squares/example.vim +19 -0
  47. data/tracks/vimscript/exercises/raindrops/example.vim +9 -0
  48. data/tracks/vimscript/exercises/raindrops/raindrops.vader +53 -0
  49. data/tracks/vimscript/exercises/raindrops/raindrops.vim +18 -0
  50. data/tracks/vimscript/exercises/rna-transcription/example.vim +3 -0
  51. data/tracks/vimscript/exercises/rna-transcription/rna_transcription.vader +23 -0
  52. data/tracks/vimscript/exercises/rna-transcription/rna_transcription.vim +20 -0
  53. metadata +16 -2
@@ -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('./anagram.R')
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
- c()
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
- c("tan")
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
- c()
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
- c("stream","maters")
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
- c()
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
- c("inlets")
49
- )
43
+ c("inlets"))
50
44
  })
51
45
 
52
46
  test_that("detects multiple anagrams", {
53
47
  subject <- "allergy"
54
- candidates <- c("gallery","ballerina","regally","clergy","largely","leading")
48
+ candidates <-
49
+ c("gallery", "ballerina", "regally", "clergy", "largely", "leading")
55
50
  expect_equal(anagram(subject, candidates),
56
- c("gallery","regally","largely")
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
- c("cron")
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
- c()
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
- c("Carthorse")
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
- c("carthorse")
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
- c("Carthorse")
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
- c()
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
- c()
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
- c()
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
- c()
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
- c("ΒΓΑ","γβα")
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
- c()
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
- c()
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
- c()
161
- )
142
+ c())
162
143
  })
163
144
 
164
145
  print("All tests passed!")
@@ -1,197 +1,176 @@
1
- source('./bob.R')
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
- "Whatever."
8
- )
7
+ "Whatever.")
9
8
  })
10
9
 
11
10
  test_that("shouting", {
12
11
  input <- "WATCH OUT!"
13
12
  expect_equal(bob(input),
14
- "Whoa, chill out!"
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
- "Whoa, chill out!"
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
- "Sure."
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
- "Sure."
36
- )
31
+ "Sure.")
37
32
  })
38
33
 
39
34
  test_that("asking gibberish", {
40
35
  input <- "fffbbcbeab?"
41
36
  expect_equal(bob(input),
42
- "Sure."
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
- "Whatever."
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
- "Whatever."
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
- "Whoa, chill out!"
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
- "Whoa, chill out!"
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
- "Whatever."
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
- "Sure."
78
+ "Sure."
85
79
  )
86
- })
87
-
88
- test_that("shouting with special characters", {
89
- input <- "ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"
90
- expect_equal(bob(input),
91
- "Whoa, chill out!"
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
- "Whoa, chill out!"
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
- "Whatever."
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
- "Whoa, chill out!"
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
- "Whatever."
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
- "Sure."
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
- "Sure."
134
- )
121
+ "Sure.")
135
122
  })
136
123
 
137
124
  test_that("silence", {
138
125
  input <- ""
139
126
  expect_equal(bob(input),
140
- "Fine. Be that way!"
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
- "Fine. Be that way!"
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
- "Fine. Be that way!"
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
- "Whatever."
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
- "Whatever."
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
- "Sure."
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
- "Fine. Be that way!"
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
- "Whatever."
194
- )
173
+ "Whatever.")
195
174
  })
196
175
 
197
176
  print("All tests passed!")