trackler 2.2.1.115 → 2.2.1.116

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/yacht/canonical-data.json +251 -0
  4. data/problem-specifications/exercises/yacht/description.md +34 -0
  5. data/problem-specifications/exercises/yacht/metadata.yml +5 -0
  6. data/tracks/c/docs/C_STYLE_GUIDE.md +4 -4
  7. data/tracks/csharp/config.json +1 -1
  8. data/tracks/dart/.travis.yml +2 -4
  9. data/tracks/dart/CONTRIBUTING.md +2 -6
  10. data/tracks/dart/bin/check_formatting.dart +17 -0
  11. data/tracks/dart/bin/presubmit.dart +20 -0
  12. data/tracks/dart/config.json +1 -1
  13. data/tracks/dart/exercises/hamming/lib/example.dart +1 -1
  14. data/tracks/dart/exercises/hamming/test/hamming_test.dart +33 -20
  15. data/tracks/dart/exercises/word-count/pubspec.yaml +1 -1
  16. data/tracks/dart/exercises/word-count/test/word_count_test.dart +30 -20
  17. data/tracks/dart/lib/src/utils.dart +58 -0
  18. data/tracks/dart/pubspec.yaml +1 -0
  19. data/tracks/python/.github/stale.yml +1 -0
  20. data/tracks/scala/config.json +2 -2
  21. data/tracks/scala/exercises/space-age/src/test/scala/SpaceAgeTest.scala +2 -2
  22. data/tracks/scala/exercises/spiral-matrix/src/test/scala/SpiralMatrixTest.scala +20 -25
  23. data/tracks/scala/exercises/sublist/src/test/scala/SublistTest.scala +27 -19
  24. data/tracks/scala/exercises/sum-of-multiples/src/test/scala/SumOfMultiplesTest.scala +15 -15
  25. data/tracks/scala/testgen/src/main/scala/SpaceAgeTestGenerator.scala +9 -8
  26. data/tracks/scala/testgen/src/main/scala/SpiralMatrixTestGenerator.scala +2 -4
  27. data/tracks/scala/testgen/src/main/scala/SublistTestGenerator.scala +3 -3
  28. data/tracks/scala/testgen/src/main/scala/SumOfMultiplesTestGenerator.scala +6 -6
  29. data/tracks/scala/testgen/src/main/scala/testgen/TestSuiteBuilder.scala +8 -0
  30. data/tracks/typescript/config.json +45 -15
  31. data/tracks/typescript/exercises/bracket-push/README.md +36 -0
  32. data/tracks/typescript/exercises/bracket-push/bracket-push.example.ts +50 -0
  33. data/tracks/typescript/exercises/bracket-push/bracket-push.test.ts +73 -0
  34. data/tracks/typescript/exercises/bracket-push/bracket-push.ts +0 -0
  35. data/tracks/typescript/exercises/bracket-push/package.json +36 -0
  36. data/tracks/typescript/exercises/bracket-push/tsconfig.json +22 -0
  37. data/tracks/typescript/exercises/bracket-push/tslint.json +127 -0
  38. data/tracks/typescript/exercises/bracket-push/yarn.lock +2624 -0
  39. data/tracks/typescript/exercises/variable-length-quantity/README.md +64 -0
  40. data/tracks/typescript/exercises/variable-length-quantity/package.json +36 -0
  41. data/tracks/typescript/exercises/variable-length-quantity/tsconfig.json +22 -0
  42. data/tracks/typescript/exercises/variable-length-quantity/tslint.json +127 -0
  43. data/tracks/typescript/exercises/variable-length-quantity/variable-length-quantity.example.ts +55 -0
  44. data/tracks/typescript/exercises/variable-length-quantity/variable-length-quantity.test.ts +115 -0
  45. data/tracks/typescript/exercises/variable-length-quantity/variable-length-quantity.ts +0 -0
  46. data/tracks/typescript/exercises/variable-length-quantity/yarn.lock +2624 -0
  47. metadata +24 -5
  48. data/tracks/dart/bin/check_formatting +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a973bc08e042be7c0a98c8daa57f0f81d5ff009c
4
- data.tar.gz: f0ed6e91cf8aec9a4b45324e38f482cbf46e3c03
3
+ metadata.gz: 0aae28d0f054933886687244d59d5cac2b1e40e2
4
+ data.tar.gz: 224c04be34690e5137ab56043c4b023631dce533
5
5
  SHA512:
6
- metadata.gz: 52b97d29dcfe66c8569302a2a89532164f00c37353749cb3181e6a99f88430fffae43afaf825f2e4a7399a2a437af37d1dd4e66046031bed5490e83a6a35a3b2
7
- data.tar.gz: ebbb7a299f91d23a101d0a7b9a6794fac451addfc67a2e983916b5e54b641372aa5426290e6b4f92dbc9077cd62b2a39aae0b1f089650d25711d192cd3cb4b4c
6
+ metadata.gz: a93c8b0204daf3f7460f2af8f9ce338c46f93a0637eefe73b19b74c74a710c8b3bd407cf4678298bf81051aeb047ae8898ed1511fca6c6f7a73303f04c68a5a0
7
+ data.tar.gz: 21785aa9e8b63124a89b4535d889da17fc0b265cd2ac1b3ed98c561849f051035d0938bda4eac0224cb49d68b3c0eb877ccb7fb5ad191272ba49ee7ecdb491fc
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.2.1.115"
2
+ VERSION = "2.2.1.116"
3
3
  end
@@ -0,0 +1,251 @@
1
+ {
2
+ "exercise":"yacht",
3
+ "version":"1.0.0",
4
+ "comments":[
5
+ "The dice are represented always as a list of exactly five integers",
6
+ "with values between 1 and 6 inclusive. The category is an string.",
7
+ "the categories are 'ones' to 'sixes',",
8
+ "Then 'full house',",
9
+ " 'four of a kind'",
10
+ " 'little straight' 1-5",
11
+ " 'big straight' 2-6",
12
+ " 'choice', sometimes called Chance",
13
+ " 'yacht', or five of a kind"
14
+ ],
15
+ "cases":[
16
+ {
17
+ "description":"Yacht",
18
+ "property":"score",
19
+ "input":{
20
+ "dice":[5, 5, 5, 5, 5],
21
+ "category":"yacht"
22
+ },
23
+ "expected":50
24
+ },
25
+ {
26
+ "description":"Not Yacht",
27
+ "property":"score",
28
+ "input":{
29
+ "dice":[1, 3, 3, 2, 5],
30
+ "category":"yacht"
31
+ },
32
+ "expected":0
33
+ },
34
+ {
35
+ "description":"Ones",
36
+ "property":"score",
37
+ "input":{
38
+ "dice":[1, 1, 1, 3, 5],
39
+ "category":"ones"
40
+ },
41
+ "expected":3
42
+ },
43
+ {
44
+ "description":"Ones, out of order",
45
+ "property":"score",
46
+ "input":{
47
+ "dice":[3, 1, 1, 5, 1],
48
+ "category":"ones"
49
+ },
50
+ "expected":3
51
+ },
52
+ {
53
+ "description":"No ones",
54
+ "property":"score",
55
+ "input":{
56
+ "dice":[4, 3, 6, 5, 5],
57
+ "category":"ones"
58
+ },
59
+ "expected":0
60
+ },
61
+ {
62
+ "description":"Twos",
63
+ "property":"score",
64
+ "input":{
65
+ "dice":[2, 3, 4, 5, 6],
66
+ "category":"twos"
67
+ },
68
+ "expected":2
69
+ },
70
+ {
71
+ "description":"Fours",
72
+ "property":"score",
73
+ "input":{
74
+ "dice":[1, 4, 1, 4, 1],
75
+ "category":"fours"
76
+ },
77
+ "expected":8
78
+ },
79
+ {
80
+ "description":"Yacht counted as threes",
81
+ "property":"score",
82
+ "input":{
83
+ "dice":[3, 3, 3, 3, 3],
84
+ "category":"threes"
85
+ },
86
+ "expected":15
87
+ },
88
+ {
89
+ "description":"Yacht of 3s counted as fives",
90
+ "property":"score",
91
+ "input":{
92
+ "dice":[3, 3, 3, 3, 3],
93
+ "category":"fives"
94
+ },
95
+ "expected":0
96
+ },
97
+ {
98
+ "description":"Sixes",
99
+ "property":"score",
100
+ "input":{
101
+ "dice":[2, 3, 4, 5 ,6],
102
+ "category":"sixes"
103
+ },
104
+ "expected":6
105
+ },
106
+ {
107
+ "description":"Full house two small, three big",
108
+ "property":"score",
109
+ "input":{
110
+ "dice":[2, 2, 4, 4, 4],
111
+ "category":"full house"
112
+ },
113
+ "expected":16
114
+ },
115
+ {
116
+ "description":"Full house three small, two big",
117
+ "property":"score",
118
+ "input":{
119
+ "dice":[5, 3, 3, 5, 3],
120
+ "category":"full house"
121
+ },
122
+ "expected":19
123
+ },
124
+ {
125
+ "description":"Two pair is not a full house",
126
+ "property":"score",
127
+ "input":{
128
+ "dice":[2, 2, 4, 4, 5],
129
+ "category":"full house"
130
+ },
131
+ "expected":0
132
+ },
133
+ {
134
+ "description":"Yacht is not a full house",
135
+ "property":"score",
136
+ "input":{
137
+ "dice":[2, 2, 2, 2, 2],
138
+ "category":"full house"
139
+ },
140
+ "expected":0
141
+ },
142
+ {
143
+ "description":"Four of a Kind",
144
+ "property":"score",
145
+ "input":{
146
+ "dice":[6, 6, 4, 6, 6],
147
+ "category":"four of a kind"
148
+ },
149
+ "expected":24
150
+ },
151
+ {
152
+ "description":"Yacht can be scored as Four of a Kind",
153
+ "property":"score",
154
+ "input":{
155
+ "dice":[3, 3, 3, 3, 3],
156
+ "category":"four of a kind"
157
+ },
158
+ "expected":12
159
+ },
160
+ {
161
+ "description":"Full house is not Four of a Kind",
162
+ "property":"score",
163
+ "input":{
164
+ "dice":[3, 3, 3, 5, 5],
165
+ "category":"four of a kind"
166
+ },
167
+ "expected":0
168
+ },
169
+ {
170
+ "description":"Little Straight",
171
+ "property":"score",
172
+ "input":{
173
+ "dice":[3, 5, 4, 1, 2],
174
+ "category":"little straight"
175
+ },
176
+ "expected":30
177
+ },
178
+ {
179
+ "description":"Little Straight as Big Straight",
180
+ "property":"score",
181
+ "input":{
182
+ "dice":[1, 2, 3, 4, 5],
183
+ "category":"big straight"
184
+ },
185
+ "expected":0
186
+ },
187
+ {
188
+ "description":"Four in order but not a little straight",
189
+ "property":"score",
190
+ "input":{
191
+ "dice":[1, 1, 2, 3, 4],
192
+ "category":"little straight"
193
+ },
194
+ "expected":0
195
+ },
196
+ {
197
+ "description":"No pairs but not a little straight",
198
+ "property":"score",
199
+ "input":{
200
+ "dice":[1, 2, 3, 4, 6],
201
+ "category":"little straight"
202
+ },
203
+ "expected":0
204
+ },
205
+ {
206
+ "description":"Minimum is 1, maximum is 5, but not a little straight",
207
+ "property":"score",
208
+ "input":{
209
+ "dice":[1, 1, 3, 4, 5],
210
+ "category":"little straight"
211
+ },
212
+ "expected":0
213
+ },
214
+ {
215
+ "description":"Big Straight",
216
+ "property":"score",
217
+ "input":{
218
+ "dice":[4, 6, 2, 5, 3],
219
+ "category":"big straight"
220
+ },
221
+ "expected":30
222
+ },
223
+ {
224
+ "description":"Big Straight as little straight",
225
+ "property":"score",
226
+ "input":{
227
+ "dice":[6, 5, 4, 3, 2],
228
+ "category":"little straight"
229
+ },
230
+ "expected":0
231
+ },
232
+ {
233
+ "description":"Choice",
234
+ "property":"score",
235
+ "input":{
236
+ "dice":[3, 3, 5, 6, 6],
237
+ "category":"choice"
238
+ },
239
+ "expected":23
240
+ },
241
+ {
242
+ "description":"Yacht as choice",
243
+ "property":"score",
244
+ "input":{
245
+ "dice":[2, 2, 2, 2, 2],
246
+ "category":"choice"
247
+ },
248
+ "expected":10
249
+ }
250
+ ]
251
+ }
@@ -0,0 +1,34 @@
1
+ # Score a single throw of dice in *Yacht*
2
+
3
+ The dice game [Yacht](https://en.wikipedia.org/wiki/Yacht_(dice_game)) is from
4
+ the same family as Poker Dice, Generala and particularly Yahtzee, of which it
5
+ is a precursor. In the game, five dice are rolled and the result can be entered
6
+ in any of twelve categories. The score of a throw of the dice depends on
7
+ category chosen.
8
+
9
+ ## Scores in Yacht
10
+
11
+ Category Score Example
12
+ Ones 1 × number of ones 1 1 1 4 5 scores 3
13
+ Twos 2 × number of twos 2 2 3 4 5 scores 4
14
+ Threes 3 × number of threes 3 3 3 3 3 scores 15
15
+ Fours 4 × number of fours 1 2 3 3 5 scores 0
16
+ Fives 5 × number of fives 5 1 5 2 5 scores 15
17
+ Sixes 6 × number of sixes 2 3 4 5 6 scores 6
18
+ Full House Total of the dice 3 3 3 5 5 scores 19
19
+ Four of a Kind Total of the four dice 4 4 4 4 6 scores 16
20
+ Little Straight 30 points 1 2 3 4 5 scores 30
21
+ Big Straight 30 points 2 3 4 5 6 scores 30
22
+ Choice Sum of the dice 2 3 3 4 6 scores 18
23
+ Yacht 50 points 4 4 4 4 4 scores 50
24
+
25
+ If the dice do not satisfy the requirements of a category, the score is zero.
26
+ If, for example, *Four Of A Kind* is entered in the *Yacht* category, zero
27
+ points are scored. A *Yacht* scores zero if entered in the *Full House* category.
28
+
29
+ ## Task
30
+ Given a list of values for five dice and a category, your solution should return
31
+ the score of the dice for that category. If the dice do not satisfy the requirements
32
+ of the category your solution should return 0. You can assume that five values
33
+ will always be presented, and the value of each will be between one and six
34
+ inclusively. You should not assume that the dice are ordered.
@@ -0,0 +1,5 @@
1
+ ---
2
+ blurb: "Score a single throw of dice in the game Yacht"
3
+ source: "James Kilfiger, using wikipedia"
4
+ source_url: "https://en.wikipedia.org/wiki/Yacht_(dice_game)"
5
+
@@ -118,10 +118,7 @@ Like most C source files, a test file begins with includes.
118
118
  // any other includes here
119
119
  ```
120
120
 
121
- The includes are then followed by any helper functions that are used by the test functions.
122
- The names of such helper functions should not use the `test_` prefix.
123
-
124
- Next, there are the `setUp()` and `tearDown()` functions.
121
+ The includes are then followed by the `setUp()` and `tearDown()` functions.
125
122
  So far, no exercise uses these (the function bodies are empty) yet they must remain in place to allow the test files to compile correctly across all platforms.
126
123
 
127
124
  ```c
@@ -134,6 +131,9 @@ void tearDown(void)
134
131
  }
135
132
  ```
136
133
 
134
+ Next are any helper functions that are used by the test functions.
135
+ The names of such helper functions should not use the `test_` prefix.
136
+
137
137
  Next are the test functions themselves.
138
138
  The names of these functions use a `test_` prefix.
139
139
  Excepting the first, each test function should have `TEST_IGNORE();` as its first statement.
@@ -923,7 +923,7 @@
923
923
  "algorithms",
924
924
  "matrices"
925
925
  ],
926
- "unlocked_by": "matrix",
926
+ "unlocked_by": "kindergarten-garden",
927
927
  "uuid": "bae1f3a4-b63d-4efd-921a-133b3d5e379c"
928
928
  },
929
929
  {
@@ -13,9 +13,7 @@ cache:
13
13
  - $HOME/.pub-cache
14
14
 
15
15
  before_script:
16
- - bin/check_formatting
16
+ - pub run bin/check_formatting.dart
17
17
 
18
18
  script:
19
- - bin/fetch-configlet
20
- - bin/configlet lint .
21
- - pub run test test/
19
+ - pub run bin/presubmit.dart
@@ -31,12 +31,8 @@ Please keep the following in mind:
31
31
  * Sensitive information (email address, real names, etc)
32
32
 
33
33
  - Please run the following commands before submitting your PR:
34
- * `pub run test` - All the tests for Dart exercises can be run from the top level of the repo with this command
35
- * `bin/fetch-configlet` - Downloads the latest version of configlet and stores it in the bin/ directory
36
- * `bin/configlet lint --track-id dart .` - Checks the config.json for formatting issues
37
- * `bin/configlet fmt .` - Formats the config.json
38
- * `bin/check_formatting` - Checks All the Dart files for formatting issues
39
- * `pub run dart_style:format -l 120 -w .` - Formats all the Dart files
34
+ * `pub run bin/check_formatting.dart` - Checks the config.json and all Dart files for formatting issues
35
+ * `pub run bin/presubmit.dart` - Runs the test for Dart exercises, and formats config.json and all Dart files
40
36
 
41
37
  - Once a Pull Request is approved, the contributing branch will be rebased onto the latest version of our master branch.
42
38
 
@@ -0,0 +1,17 @@
1
+ import 'dart:async';
2
+ import 'package:exercism_dart/src/utils.dart';
3
+
4
+ Future<Null> main() async {
5
+ final CommonUtils utils = new CommonUtils();
6
+
7
+ if (utils.fetchConfiglet() == 0) {
8
+ print('Checking config.json formatting...');
9
+ await utils.runCmdIfExecutable('bin/configlet', ['lint', '--track-id', 'dart', '.']);
10
+ }
11
+
12
+ print('Checking all Dart files formatting...');
13
+ await utils.runCmd('pub', ['run', 'dart_style:format', '-l', '120', '-n', '.']);
14
+
15
+ await utils.terminate();
16
+ print('Done!');
17
+ }
@@ -0,0 +1,20 @@
1
+ import 'dart:async';
2
+ import 'package:exercism_dart/src/utils.dart';
3
+
4
+ Future<Null> main() async {
5
+ final CommonUtils utils = new CommonUtils();
6
+
7
+ if (utils.fetchConfiglet() == 0) {
8
+ print('Formatting config.json...');
9
+ await utils.runCmdIfExecutable('bin/configlet', ['fmt', '.']);
10
+ }
11
+
12
+ print('Formatting all Dart files...');
13
+ await utils.runCmd('pub', ['run', 'dart_style:format', '-l', '120', '-w', '.']);
14
+
15
+ print('Running tests...');
16
+ await utils.runCmd('pub', ['run', 'test']);
17
+
18
+ await utils.terminate();
19
+ print('Done!');
20
+ }
@@ -142,4 +142,4 @@
142
142
  "foregone": [],
143
143
  "language": "Dart",
144
144
  "test_pattern": "_test\\.dart$"
145
- }
145
+ }
@@ -1,5 +1,5 @@
1
1
  class Hamming {
2
- int compute(String a, String b) {
2
+ int distance(String a, String b) {
3
3
  if (a.length != b.length) {
4
4
  throw new ArgumentError("DNA strands must be of equal length.");
5
5
  }
@@ -1,71 +1,84 @@
1
- import "package:test/test.dart";
2
- import "package:hamming/hamming.dart";
1
+ import 'package:test/test.dart';
2
+ import 'package:hamming/hamming.dart';
3
3
 
4
4
  /// Test cases match one-to-one with those described
5
5
  /// in the problem specification found here:
6
6
  /// https://github.com/exercism/problem-specifications/blob/master/exercises/hamming/canonical-data.json
7
7
  void main() {
8
- final hamming = new Hamming();
8
+ final Hamming hamming = new Hamming();
9
9
 
10
- group("Hamming", () {
10
+ group('Hamming', () {
11
11
  test("empty strands", () {
12
- expect(hamming.compute("", ""), equals(0));
13
- });
12
+ final int result = hamming.distance("", "");
13
+ expect(result, equals(0));
14
+ }, skip: false);
14
15
 
15
16
  test("identical strands", () {
16
- expect(hamming.compute("A", "A"), equals(0));
17
+ final int result = hamming.distance("A", "A");
18
+ expect(result, equals(0));
17
19
  }, skip: true);
18
20
 
19
21
  test("long identical strands", () {
20
- expect(hamming.compute("GGACTGA", "GGACTGA"), equals(0));
22
+ final int result = hamming.distance("GGACTGA", "GGACTGA");
23
+ expect(result, equals(0));
21
24
  }, skip: true);
22
25
 
23
26
  test("complete distance in single nucleotide strands", () {
24
- expect(hamming.compute("A", "G"), equals(1));
27
+ final int result = hamming.distance("A", "G");
28
+ expect(result, equals(1));
25
29
  }, skip: true);
26
30
 
27
31
  test("complete distance in small strands", () {
28
- expect(hamming.compute("AG", "CT"), equals(2));
32
+ final int result = hamming.distance("AG", "CT");
33
+ expect(result, equals(2));
29
34
  }, skip: true);
30
35
 
31
36
  test("small distance in small strands", () {
32
- expect(hamming.compute("AT", "CT"), equals(1));
37
+ final int result = hamming.distance("AT", "CT");
38
+ expect(result, equals(1));
33
39
  }, skip: true);
34
40
 
35
41
  test("small distance", () {
36
- expect(hamming.compute("GGACG", "GGTCG"), equals(1));
42
+ final int result = hamming.distance("GGACG", "GGTCG");
43
+ expect(result, equals(1));
37
44
  }, skip: true);
38
45
 
39
46
  test("small distance in long strands", () {
40
- expect(hamming.compute("ACCAGGG", "ACTATGG"), equals(2));
47
+ final int result = hamming.distance("ACCAGGG", "ACTATGG");
48
+ expect(result, equals(2));
41
49
  }, skip: true);
42
50
 
43
51
  test("non-unique character in first strand", () {
44
- expect(hamming.compute("AAG", "AAA"), equals(1));
52
+ final int result = hamming.distance("AAG", "AAA");
53
+ expect(result, equals(1));
45
54
  }, skip: true);
46
55
 
47
56
  test("non-unique character in second strand", () {
48
- expect(hamming.compute("AAA", "AAG"), equals(1));
57
+ final int result = hamming.distance("AAA", "AAG");
58
+ expect(result, equals(1));
49
59
  }, skip: true);
50
60
 
51
61
  test("same nucleotides in different positions", () {
52
- expect(hamming.compute("TAG", "GAT"), equals(2));
62
+ final int result = hamming.distance("TAG", "GAT");
63
+ expect(result, equals(2));
53
64
  }, skip: true);
54
65
 
55
66
  test("large distance", () {
56
- expect(hamming.compute("GATACA", "GCATAA"), equals(4));
67
+ final int result = hamming.distance("GATACA", "GCATAA");
68
+ expect(result, equals(4));
57
69
  }, skip: true);
58
70
 
59
71
  test("large distance in off-by-one strand", () {
60
- expect(hamming.compute("GGACGGATTCTG", "AGGACGGATTCT"), equals(9));
72
+ final int result = hamming.distance("GGACGGATTCTG", "AGGACGGATTCT");
73
+ expect(result, equals(9));
61
74
  }, skip: true);
62
75
 
63
76
  test("disallow first strand longer", () {
64
- expect(() => hamming.compute("AATG", "AAA"), throwsArgumentError);
77
+ expect(() => hamming.distance("AATG", "AAA"), throwsArgumentError);
65
78
  }, skip: true);
66
79
 
67
80
  test("disallow second strand longer", () {
68
- expect(() => hamming.compute("ATA", "AGTG"), throwsArgumentError);
81
+ expect(() => hamming.distance("ATA", "AGTG"), throwsArgumentError);
69
82
  }, skip: true);
70
83
  });
71
84
  }