trackler 2.0.6.22 → 2.0.6.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/common/exercises/book-store/canonical-data.json +61 -80
  3. data/common/exercises/etl/canonical-data.json +69 -0
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/go/config.json +10 -4
  6. data/tracks/java/config.json +13 -1
  7. data/tracks/java/exercises/diamond/build.gradle +17 -0
  8. data/tracks/java/exercises/diamond/src/example/java/DiamondPrinter.java +41 -0
  9. data/tracks/java/exercises/diamond/src/main/java/DiamondPrinter.java +5 -0
  10. data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +111 -0
  11. data/tracks/java/exercises/grade-school/src/example/java/School.java +20 -19
  12. data/tracks/java/exercises/grade-school/src/test/java/SchoolTest.java +53 -20
  13. data/tracks/java/exercises/secret-handshake/build.gradle +17 -0
  14. data/tracks/java/exercises/secret-handshake/src/example/java/HandshakeCalculator.java +29 -0
  15. data/tracks/java/exercises/secret-handshake/src/example/java/Signal.java +1 -0
  16. data/tracks/java/exercises/secret-handshake/src/main/java/HandshakeCalculator.java +5 -0
  17. data/tracks/java/exercises/secret-handshake/src/main/java/Signal.java +5 -0
  18. data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +106 -0
  19. data/tracks/java/exercises/settings.gradle +2 -0
  20. data/tracks/julia/config.json +42 -0
  21. data/tracks/julia/exercises/bob/bob.jl +3 -0
  22. data/tracks/julia/exercises/bob/example.jl +30 -0
  23. data/tracks/julia/exercises/bob/runtests.jl +70 -0
  24. data/tracks/julia/exercises/difference-of-squares/difference-of-squares.jl +14 -0
  25. data/tracks/julia/exercises/difference-of-squares/example.jl +9 -0
  26. data/tracks/julia/exercises/difference-of-squares/runtests.jl +22 -0
  27. data/tracks/julia/exercises/hamming/example.jl +5 -0
  28. data/tracks/julia/exercises/hamming/hamming.jl +3 -0
  29. data/tracks/julia/exercises/hamming/runtests.jl +42 -0
  30. data/tracks/julia/exercises/hello-world/example.jl +3 -0
  31. data/tracks/julia/exercises/hello-world/hello-world.jl +3 -0
  32. data/tracks/julia/exercises/hello-world/runtests.jl +12 -0
  33. data/tracks/julia/exercises/word-count/example.jl +9 -0
  34. data/tracks/julia/exercises/word-count/runtests.jl +47 -0
  35. data/tracks/julia/exercises/word-count/word-count.jl +3 -0
  36. data/tracks/objective-c/config.json +10 -0
  37. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +6 -0
  38. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +48 -0
  39. data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +110 -0
  40. data/tracks/objective-c/xcodeProject/ObjectiveC.xcodeproj/project.pbxproj +33 -0
  41. data/tracks/ocaml/config.json +5 -0
  42. data/tracks/ocaml/exercises/pangram/.merlin +3 -0
  43. data/tracks/ocaml/exercises/pangram/Makefile +11 -0
  44. data/tracks/ocaml/exercises/pangram/example.ml +9 -0
  45. data/tracks/ocaml/exercises/pangram/pangram.mli +1 -0
  46. data/tracks/ocaml/exercises/pangram/test.ml +29 -0
  47. data/tracks/ocaml/tools/test-generator/templates/pangram/template.ml +15 -0
  48. data/tracks/pascal/config.json +8 -0
  49. data/tracks/pascal/docs/INSTALLATION.md +3 -3
  50. data/tracks/pascal/docs/img/07delphiclicklibrarypathbuttonLogo.png +0 -0
  51. data/tracks/pascal/exercises/grains/GrainsTests.dpr +60 -0
  52. data/tracks/pascal/exercises/grains/uGrainsExample.pas +33 -0
  53. data/tracks/pascal/exercises/grains/uGrainsTests.pas +149 -0
  54. data/tracks/perl6/SETUP.md +8 -2
  55. metadata +41 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c345469ef70e6d1cbdbb6629050afdbcba27689
4
- data.tar.gz: 9ed54ec084197a08ff4bda1d1bdf6b4564870250
3
+ metadata.gz: 9cf87d7b9dd56a6a58b3c1d87d9a23ef21f730d8
4
+ data.tar.gz: eb35ab1854d690d7fc64b61977fe31f29d3735c5
5
5
  SHA512:
6
- metadata.gz: b6bc4c64ea54985dac6440d9d36d65d8c33023ec2542412cb1a3fdd25ff3c83aa69d49bdc9ee15ec239ca08cd8efa6b7af9dd08270959c772744ee4cd0bba5d9
7
- data.tar.gz: 2200f840688526466ff8de0f90e81638d9409f6c261a008fb1245da36d81f672b344bd117e76c94ee9e8ce8f09eed41ad5650926c73463899346c5035fc0134f
6
+ metadata.gz: fa2bf7b5e78b0ae76d088865728a0703ff112c64841abcc5eb621e9bfc76b367ff3c247d27788c990034c6e9af98a64d7cb2862c4c2a881189b41d909bb6c6b3
7
+ data.tar.gz: 967886a22857e8f2e2bebb00ffd20a2ed6102c649a66f9e555a76524dbaf63371fd83239697bee6866cc0fd69858bd7f66c644e5e006cb2d72a672df800685b7
@@ -1,106 +1,87 @@
1
1
  {
2
- "book-store": {
3
- "description": [
4
- "Calculate lowest price for shopping basket only ",
5
- "containing books from a single series. There is no ",
6
- "discount advantage for having more than one copy of ",
7
- "any single book in a grouping."
8
- ],
9
- "cases": [
2
+ "book-store": {
3
+ "description": [
4
+ "Calculate lowest price for a shopping basket containing ",
5
+ "books only from a single series. There is no ",
6
+ "discount advantage for having more than one copy of ",
7
+ "any single book in a grouping."
8
+ ],
9
+ "total": {
10
+ "description": "returns the total basket price after applying best discount",
11
+ "cases": [
10
12
  {
11
- "description": "A basket containing only a single book.",
12
- "basket": [1],
13
- "targetgrouping": [[1]],
14
- "expected": 8.0
13
+ "description": "Only a single book",
14
+ "basket": [1],
15
+ "targetgrouping": [[1]],
16
+ "expected": 8.00
15
17
  },
16
18
  {
17
- "description": "A basket containing only two of the same book.",
18
- "basket": [2, 2],
19
- "targetgrouping": [[2], [2]],
20
- "expected": 16.0
19
+ "description": "Two of the same book",
20
+ "basket": [2,2],
21
+ "targetgrouping": [[2],[2]],
22
+ "expected": 16.00
21
23
  },
22
24
  {
23
- "description": "No charge to carry around an empty basket.",
24
- "basket": [],
25
- "targetgrouping": [],
26
- "expected": 0.0
25
+ "description": "Empty basket",
26
+ "basket": [],
27
+ "targetgrouping": [],
28
+ "expected": 0.00
27
29
  },
28
30
  {
29
- "description": "A basket containing only two different books.",
30
- "basket": [1, 2],
31
- "targetgrouping": [[1, 2]],
32
- "expected": 15.2
31
+ "description": "Two different books",
32
+ "basket": [1,2],
33
+ "targetgrouping": [[1,2]],
34
+ "expected": 15.20
33
35
  },
34
36
  {
35
- "description": "A basket of three different books.",
36
- "basket": [1, 2, 3],
37
- "targetgrouping": [[1, 2, 3]],
38
- "expected": 21.60
37
+ "description": "Three different books",
38
+ "basket": [1,2,3],
39
+ "targetgrouping": [[1,2,3]],
40
+ "expected": 21.60
39
41
  },
40
42
  {
41
- "description": "A basket of four different books.",
42
- "basket": [1, 2, 3, 4],
43
- "targetgrouping": [[1, 2, 3, 4]],
44
- "expected": 25.60
43
+ "description": "Four different books",
44
+ "basket": [1,2,3,4],
45
+ "targetgrouping": [[1,2,3,4]],
46
+ "expected": 25.60
45
47
  },
46
48
  {
47
- "description": "A basket of five different books.",
48
- "basket": [1, 2, 3, 4, 5],
49
- "targetgrouping": [[1, 2, 3, 4, 5]],
50
- "expected": 30.00
49
+ "description": "Five different books",
50
+ "basket": [1,2,3,4,5],
51
+ "targetgrouping": [[1,2,3,4,5]],
52
+ "expected": 30.00
51
53
  },
52
54
  {
53
- "description": [
54
- "A basket containing eight books consisting of a ",
55
- "pair each of the first three books plus one copy ",
56
- "each of the last two books. Please pay careful ",
57
- "attention to this particular target grouping, it ",
58
- "is not intuitive, but does grant the largest ",
59
- "discount."
60
- ],
61
- "basket": [1, 1, 2, 2, 3, 3, 4, 5],
62
- "targetgrouping": [[1, 2, 3, 4], [1, 2, 3, 5]],
63
- "expected": 51.20
55
+ "description": "Two each of first 3 books and 1 copy each of rest",
56
+ "basket": [1,1,2,2,3,3,4,5],
57
+ "targetgrouping": [[1,2,3,4],[1,2,3,5]],
58
+ "expected": 51.20
64
59
  },
65
60
  {
66
- "description": [
67
- "A basket containing nine books consisting of a ",
68
- "pair each of the first four books plus one of ",
69
- "the last book."
70
- ],
71
- "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5],
72
- "targetgrouping": [[1, 2, 3, 4, 5], [1, 2, 3, 4]],
73
- "expected": 55.60
61
+ "description": "Two each of first 4 books and 1 copy each of rest",
62
+ "basket": [1,1,2,2,3,3,4,4,5],
63
+ "targetgrouping": [[1,2,3,4,5],[1,2,3,4]],
64
+ "expected": 55.60
74
65
  },
75
66
  {
76
- "description": [
77
- "A basket containing ten books consisting of two ",
78
- "copies of each book in the series."
79
- ],
80
- "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5],
81
- "targetgrouping": [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]],
82
- "expected": 60.00
67
+ "description": "Two copies of each book",
68
+ "basket": [1,1,2,2,3,3,4,4,5,5],
69
+ "targetgrouping": [[1,2,3,4,5],[1,2,3,4,5]],
70
+ "expected": 60.00
83
71
  },
84
72
  {
85
- "description": [
86
- "A basket containing eleven books consisting ",
87
- "of three copies of the first book plus two each ",
88
- "of the remaining four books in the series."
89
- ],
90
- "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1],
91
- "targetgrouping": [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1]],
92
- "expected": 68.00
73
+ "description": "Three copies of first book and 2 each of remaining",
74
+ "basket": [1,1,2,2,3,3,4,4,5,5,1],
75
+ "targetgrouping": [[1,2,3,4,5],[1,2,3,4,5],[1]],
76
+ "expected": 68.00
93
77
  },
94
78
  {
95
- "description": [
96
- "A basket containing twelve books consisting of ",
97
- "three copies of the first two books, plus two ",
98
- "each of the remaining three books in the series."
99
- ],
100
- "basket": [1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2],
101
- "targetgrouping": [[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2]],
102
- "expected": 75.20
79
+ "description": "Three each of first 2 books and 2 each of remaining books",
80
+ "basket": [1,1,2,2,3,3,4,4,5,5,1,2],
81
+ "targetgrouping": [[1,2,3,4,5],[1,2,3,4,5],[1,2]],
82
+ "expected": 75.20
103
83
  }
104
- ]
105
- }
84
+ ]
85
+ }
86
+ }
106
87
  }
@@ -0,0 +1,69 @@
1
+ {
2
+ "transform": {
3
+ "#": [
4
+ "Note: The expected input data for these tests should have",
5
+ "integer keys (not stringified numbers as shown in the JSON below",
6
+ "Unless the language prohibits that, please implement these tests",
7
+ "such that keys are integers. e.g. in JavaScript, it might look ",
8
+ "like `transform( { 1: ['A'] } );`"
9
+ ],
10
+ "description": "transforms the a set of scrabble data previously indexed by the tile score to a set of data indexed by the tile letter",
11
+ "cases": [
12
+ {
13
+ "description": "a single letter",
14
+ "input": {
15
+ "1": ["A"]
16
+ },
17
+ "expected": {
18
+ "a" : 1
19
+ }
20
+ },
21
+ {
22
+ "description": "single score with multiple letters",
23
+ "input": {
24
+ "1": ["A", "E", "I", "O", "U" ]
25
+ },
26
+ "expected": {
27
+ "a" : 1,
28
+ "e" : 1,
29
+ "i" : 1,
30
+ "o" : 1,
31
+ "u" : 1
32
+ }
33
+ },
34
+ {
35
+ "description": "multiple scores with multiple letters",
36
+ "input": {
37
+ "1": ["A", "E"],
38
+ "2": ["D", "G"]
39
+ },
40
+ "expected": {
41
+ "a" : 1,
42
+ "e" : 1,
43
+ "d" : 2,
44
+ "g" : 2
45
+ }
46
+ },
47
+ {
48
+ "description": "multiple scores with differing numbers of letters",
49
+ "input": {
50
+ "1": [ "A", "E", "I", "O", "U", "L", "N", "R", "S", "T" ],
51
+ "2": [ "D", "G" ],
52
+ "3": [ "B", "C", "M", "P" ],
53
+ "4": [ "F", "H", "V", "W", "Y" ],
54
+ "5": [ "K" ],
55
+ "8": [ "J", "X" ],
56
+ "10": [ "Q", "Z" ]
57
+ },
58
+ "expected": {
59
+ "a": 1, "b": 3, "c": 3, "d": 2, "e": 1,
60
+ "f": 4, "g": 2, "h": 4, "i": 1, "j": 8,
61
+ "k": 5, "l": 1, "m": 3, "n": 1, "o": 1,
62
+ "p": 3, "q": 10, "r": 1, "s": 1, "t": 1,
63
+ "u": 1, "v": 4, "w": 4, "x": 8, "y": 4,
64
+ "z": 10
65
+ }
66
+ }
67
+ ]
68
+ }
69
+ }
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.0.6.22"
2
+ VERSION = "2.0.6.23"
3
3
  end
@@ -90,14 +90,20 @@
90
90
  ]
91
91
  },
92
92
  {
93
- "difficulty": 1,
93
+ "difficulty": 2,
94
94
  "slug": "pangram",
95
- "topics": []
95
+ "topics": [
96
+ "Control-flow (loops)",
97
+ "Strings"
98
+ ]
96
99
  },
97
100
  {
98
- "difficulty": 1,
101
+ "difficulty": 2,
99
102
  "slug": "bob",
100
- "topics": []
103
+ "topics": [
104
+ "Control-flow (conditionals)",
105
+ "Strings"
106
+ ]
101
107
  },
102
108
  {
103
109
  "difficulty": 1,
@@ -57,7 +57,9 @@
57
57
  "twelve-days",
58
58
  "sublist",
59
59
  "rectangles",
60
- "matrix"
60
+ "matrix",
61
+ "diamond",
62
+ "secret-handshake"
61
63
  ],
62
64
  "exercises": [
63
65
  {
@@ -329,6 +331,16 @@
329
331
  "slug": "matrix",
330
332
  "difficulty": 1,
331
333
  "topics": []
334
+ },
335
+ {
336
+ "slug": "diamond",
337
+ "difficulty": 1,
338
+ "topics": []
339
+ },
340
+ {
341
+ "slug": "secret-handshake",
342
+ "difficulty": 1,
343
+ "topics": []
332
344
  }
333
345
  ],
334
346
  "deprecated": [
@@ -0,0 +1,17 @@
1
+ apply plugin: "java"
2
+ apply plugin: "eclipse"
3
+ apply plugin: "idea"
4
+
5
+ repositories {
6
+ mavenCentral()
7
+ }
8
+
9
+ dependencies {
10
+ testCompile "junit:junit:4.12"
11
+ }
12
+ test {
13
+ testLogging {
14
+ exceptionFormat = 'full'
15
+ events = ["passed", "failed", "skipped"]
16
+ }
17
+ }
@@ -0,0 +1,41 @@
1
+ import java.util.ArrayList;
2
+ import java.util.Collections;
3
+ import java.util.List;
4
+
5
+ final class DiamondPrinter {
6
+
7
+ private static final int A_INT = (int) 'A';
8
+
9
+ private static String blank(final int length) {
10
+ return String.join("", Collections.nCopies(length, " "));
11
+ }
12
+
13
+ private static String reverse(final String string) {
14
+ return new StringBuilder(string).reverse().toString();
15
+ }
16
+
17
+ List<String> printToList(final char chr) {
18
+ final int nRows = 2 * ((int) chr - A_INT) + 1;
19
+
20
+ final List<String> topRows = new ArrayList<>();
21
+
22
+ // Populate the top rows.
23
+ for (int nRow = 0; nRow < (nRows + 1) / 2; nRow++) {
24
+ final char rowChr = (char) (A_INT + nRow);
25
+
26
+ final String leftHalfOfRow = blank((nRows - 1) / 2 - nRow) + rowChr + blank(nRow);
27
+ final String rightHalfOfRow = reverse(leftHalfOfRow.substring(0, leftHalfOfRow.length() - 1));
28
+ final String fullRow = leftHalfOfRow + rightHalfOfRow;
29
+
30
+ topRows.add(fullRow);
31
+ }
32
+
33
+ // Populate the bottom rows by 'reflecting' the top rows.
34
+ for (int nRow = (nRows - 1) / 2 - 1; nRow >= 0; nRow--) {
35
+ topRows.add(topRows.get(nRow));
36
+ }
37
+
38
+ return topRows;
39
+ }
40
+
41
+ }
@@ -0,0 +1,5 @@
1
+ final class DiamondPrinter {
2
+
3
+
4
+
5
+ }
@@ -0,0 +1,111 @@
1
+ import org.junit.Ignore;
2
+ import org.junit.Test;
3
+
4
+ import java.util.List;
5
+
6
+ import static java.util.Arrays.asList;
7
+ import static java.util.Collections.singletonList;
8
+ import static org.hamcrest.CoreMatchers.is;
9
+ import static org.junit.Assert.assertThat;
10
+
11
+ public final class DiamondPrinterTest {
12
+
13
+ @Test
14
+ public void testOneByOneDiamond() {
15
+ List<String> output = new DiamondPrinter().printToList('A');
16
+ assertThat(output, is(singletonList("A")));
17
+ }
18
+
19
+ @Ignore
20
+ @Test
21
+ public void testTwoByTwoDiamond() {
22
+ List<String> output = new DiamondPrinter().printToList('B');
23
+ assertThat(output, is(asList(" A ",
24
+ "B B",
25
+ " A ")));
26
+ }
27
+
28
+ @Ignore
29
+ @Test
30
+ public void testThreeByThreeDiamond() {
31
+ List<String> output = new DiamondPrinter().printToList('C');
32
+ assertThat(output, is(asList(" A ",
33
+ " B B ",
34
+ "C C",
35
+ " B B ",
36
+ " A ")));
37
+ }
38
+
39
+ @Ignore
40
+ @Test
41
+ public void testFiveByFiveDiamond() {
42
+ List<String> output = new DiamondPrinter().printToList('E');
43
+ assertThat(output, is(asList(" A ",
44
+ " B B ",
45
+ " C C ",
46
+ " D D ",
47
+ "E E",
48
+ " D D ",
49
+ " C C ",
50
+ " B B ",
51
+ " A ")));
52
+ }
53
+
54
+ @Ignore
55
+ @Test
56
+ public void testFullDiamond() {
57
+ List<String> output = new DiamondPrinter().printToList('Z');
58
+ assertThat(output, is(asList(" A ",
59
+ " B B ",
60
+ " C C ",
61
+ " D D ",
62
+ " E E ",
63
+ " F F ",
64
+ " G G ",
65
+ " H H ",
66
+ " I I ",
67
+ " J J ",
68
+ " K K ",
69
+ " L L ",
70
+ " M M ",
71
+ " N N ",
72
+ " O O ",
73
+ " P P ",
74
+ " Q Q ",
75
+ " R R ",
76
+ " S S ",
77
+ " T T ",
78
+ " U U ",
79
+ " V V ",
80
+ " W W ",
81
+ " X X ",
82
+ " Y Y ",
83
+ "Z Z",
84
+ " Y Y ",
85
+ " X X ",
86
+ " W W ",
87
+ " V V ",
88
+ " U U ",
89
+ " T T ",
90
+ " S S ",
91
+ " R R ",
92
+ " Q Q ",
93
+ " P P ",
94
+ " O O ",
95
+ " N N ",
96
+ " M M ",
97
+ " L L ",
98
+ " K K ",
99
+ " J J ",
100
+ " I I ",
101
+ " H H ",
102
+ " G G ",
103
+ " F F ",
104
+ " E E ",
105
+ " D D ",
106
+ " C C ",
107
+ " B B ",
108
+ " A ")));
109
+ }
110
+
111
+ }