trackler 2.1.0.13 → 2.1.0.14

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 134537e7fe21dbf68cd5b2263485e4bf38e18e67
4
- data.tar.gz: dfdbe0f776c7893ad23be2cb7dd7ff585f7357a0
3
+ metadata.gz: 4133c47757d7a255d9a21636f63b479e766488b1
4
+ data.tar.gz: 54b3438d332c5590e545bccb26376e435c27bcef
5
5
  SHA512:
6
- metadata.gz: 6fdaa82e575fbe3508a780be97f97d369aad75696a3d7cacbf6fd86dd4ad5cb9b0c26893513263633e3b79aad931f4c9d577484cc6cfd28f66ea0cfab777c21a
7
- data.tar.gz: 03a9912fb641544b4f495bf186c4118c68241c5b7a7f0e47e09d6ce9af6ffc64c3e12d9a64d405d22e387f1389a64ad403865e9578e5b66b925cadf36131464a
6
+ metadata.gz: 87f951253be363fa194a43de8f2fd4b68bdc1e41d08f71e0e7a514d3bfabc8948b452768090215954a1b73e293e28f863cccce2d0a3cce4d149beacc1b2bb8fa
7
+ data.tar.gz: e669c4d8420d092bf9e5ce12dabc7ed89bc67a7cdb8ba3537af6895b31e6a1fe71c1a125b723d1a1365bfc93589efb1cf47d5895d7172028c257870ae55a82cd
@@ -11,7 +11,6 @@ module Trackler
11
11
  ]
12
12
 
13
13
  attr_reader :track, :problem
14
- attr_writer :files
15
14
  def initialize(track, problem)
16
15
  @track = track
17
16
  @problem = problem
@@ -31,6 +30,15 @@ module Trackler
31
30
  }].merge("README.md" => readme)
32
31
  end
33
32
 
33
+ def files=(value)
34
+ warn "DEPRECATION WARNING: 'Implementation#files=' is no longer public, please use 'implementation.merge_files' instead."
35
+ @files = value
36
+ end
37
+
38
+ def merge_files(new_files)
39
+ files.merge!(new_files)
40
+ end
41
+
34
42
  def zip
35
43
  @zip ||= file_bundle.zip do |io|
36
44
  io.put_next_entry('README.md')
@@ -1,3 +1,3 @@
1
1
  module Trackler
2
- VERSION = "2.1.0.13"
2
+ VERSION = "2.1.0.14"
3
3
  end
@@ -1,5 +1,5 @@
1
1
  name: matrix
2
- version: 0.1.0.2
2
+ version: 0.1.0.3
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -69,16 +69,3 @@ specs = do
69
69
 
70
70
  it "flatten" $
71
71
  flatten (intMatrix "1 2\n3 4") `shouldBe` vector [1, 2, 3, 4]
72
-
73
- it "matrix of chars" $
74
- fromString "'f' 'o' 'o'\n'b' 'a' 'r'" `shouldBe` fromList ["foo", "bar"]
75
-
76
- it "matrix of strings" $
77
- fromString "\"this one\"\n\"may be tricky!\""
78
- `shouldBe` fromList [ ["this one" ]
79
- , ["may be tricky!"] ]
80
-
81
- it "matrix of strings 2" $
82
- fromString "\"this one\" \"one\" \n\"may be tricky!\" \"really tricky\""
83
- `shouldBe` fromList [ ["this one" , "one" ]
84
- , ["may be tricky!", "really tricky"] ]
@@ -0,0 +1,10 @@
1
+ # Autodetect text files
2
+ * text=auto
3
+
4
+ # Force the following filetypes to have unix eols, so Windows does not break them
5
+ *.* text eol=lf
6
+
7
+ # Force images/fonts to be handled as binaries
8
+ *.jpg binary
9
+ *.jpeg binary
10
+ *.png binary
@@ -324,6 +324,11 @@
324
324
  "slug": "run-length-encoding",
325
325
  "difficulty": 1,
326
326
  "topics": []
327
+ },
328
+ {
329
+ "slug": "kindergarten-garden",
330
+ "difficulty": 1,
331
+ "topics": []
327
332
  }
328
333
  ],
329
334
  "deprecated": [
@@ -4,7 +4,11 @@ import org.junit.Test;
4
4
 
5
5
  import static org.junit.Assert.assertEquals;
6
6
 
7
+ /*
8
+ * version: 1.1.0
9
+ */
7
10
  public final class DifferenceOfSquaresCalculatorTest {
11
+
8
12
  private DifferenceOfSquaresCalculator calculator;
9
13
 
10
14
  @Before
@@ -13,17 +17,17 @@ public final class DifferenceOfSquaresCalculatorTest {
13
17
  }
14
18
 
15
19
  @Test
16
- public void testSquareOfSum5() {
17
- final int expected = 225;
18
- final int actual = calculator.computeSquareOfSumTo(5);
20
+ public void testSquareOfSum1() {
21
+ final int expected = 1;
22
+ final int actual = calculator.computeSquareOfSumTo(1);
19
23
  assertEquals(expected, actual);
20
24
  }
21
25
 
22
26
  @Ignore("Remove to run test")
23
27
  @Test
24
- public void testSquareOfSum10() {
25
- final int expected = 3025;
26
- final int actual = calculator.computeSquareOfSumTo(10);
28
+ public void testSquareOfSum5() {
29
+ final int expected = 225;
30
+ final int actual = calculator.computeSquareOfSumTo(5);
27
31
  assertEquals(expected, actual);
28
32
  }
29
33
 
@@ -37,17 +41,17 @@ public final class DifferenceOfSquaresCalculatorTest {
37
41
 
38
42
  @Ignore("Remove to run test")
39
43
  @Test
40
- public void testSumOfSquares5() {
41
- final int expected = 55;
42
- final int actual = calculator.computeSumOfSquaresTo(5);
44
+ public void testSumOfSquares1() {
45
+ final int expected = 1;
46
+ final int actual = calculator.computeSumOfSquaresTo(1);
43
47
  assertEquals(expected, actual);
44
48
  }
45
49
 
46
50
  @Ignore("Remove to run test")
47
51
  @Test
48
- public void testSumOfSquares10() {
49
- final int expected = 385;
50
- final int actual = calculator.computeSumOfSquaresTo(10);
52
+ public void testSumOfSquares5() {
53
+ final int expected = 55;
54
+ final int actual = calculator.computeSumOfSquaresTo(5);
51
55
  assertEquals(expected, actual);
52
56
  }
53
57
 
@@ -61,9 +65,9 @@ public final class DifferenceOfSquaresCalculatorTest {
61
65
 
62
66
  @Ignore("Remove to run test")
63
67
  @Test
64
- public void testDifferenceOfSquares0() {
68
+ public void testDifferenceOfSquares1() {
65
69
  final int expected = 0;
66
- final int actual = calculator.computeDifferenceOfSquares(0);
70
+ final int actual = calculator.computeDifferenceOfSquares(1);
67
71
  assertEquals(expected, actual);
68
72
  }
69
73
 
@@ -75,14 +79,6 @@ public final class DifferenceOfSquaresCalculatorTest {
75
79
  assertEquals(expected, actual);
76
80
  }
77
81
 
78
- @Ignore("Remove to run test")
79
- @Test
80
- public void testDifferenceOfSquares10() {
81
- final int expected = 2640;
82
- final int actual = calculator.computeDifferenceOfSquares(10);
83
- assertEquals(expected, actual);
84
- }
85
-
86
82
  @Ignore("Remove to run test")
87
83
  @Test
88
84
  public void testDifferenceOfSquares100() {
@@ -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,44 @@
1
+ import java.util.Arrays;
2
+ import java.util.List;
3
+ import java.util.ArrayList;
4
+
5
+
6
+ public class KindergartenGarden {
7
+ private String[] students;
8
+ private String garden;
9
+ private static final int PLANTS_PER_STUDENT_PER_ROW = 2;
10
+ private final int newRowLocation;
11
+
12
+ private static final String[] DEFAULT_STUDENTS = {
13
+ "Alice", "Bob", "Charlie", "David",
14
+ "Eve", "Fred", "Ginny", "Harriet",
15
+ "Ileana", "Joseph", "Kincaid", "Larry"
16
+ };
17
+
18
+ public KindergartenGarden(String garden, String[] students) {
19
+ this.garden = garden;
20
+ Arrays.sort(students);
21
+ this.students = students;
22
+ newRowLocation = garden.indexOf('\n') + 1;
23
+ }
24
+
25
+ public KindergartenGarden(String garden) {
26
+ this(garden, DEFAULT_STUDENTS);
27
+ }
28
+
29
+ public List<Plant> getPlantsOfStudent(String student) {
30
+ List<Plant> plants = new ArrayList<Plant>();
31
+ int studentPlantsIndex = Arrays.binarySearch(students, student) * PLANTS_PER_STUDENT_PER_ROW;
32
+
33
+ for (int i = studentPlantsIndex; i < studentPlantsIndex + PLANTS_PER_STUDENT_PER_ROW; i++) {
34
+ plants.add(Plant.getPlant(garden.charAt(i)));
35
+ }
36
+
37
+ for (int i = newRowLocation + studentPlantsIndex;
38
+ i < newRowLocation + studentPlantsIndex + PLANTS_PER_STUDENT_PER_ROW; i++) {
39
+ plants.add(Plant.getPlant(garden.charAt(i)));
40
+ }
41
+
42
+ return plants;
43
+ }
44
+ }
@@ -0,0 +1,21 @@
1
+ public enum Plant {
2
+ VIOLETS,
3
+ RADISHES,
4
+ CLOVER,
5
+ GRASS;
6
+
7
+ public static Plant getPlant(char plantCode) {
8
+ switch (plantCode) {
9
+ case 'G':
10
+ return GRASS;
11
+ case 'C':
12
+ return CLOVER;
13
+ case 'R':
14
+ return RADISHES;
15
+ case 'V':
16
+ return VIOLETS;
17
+ }
18
+
19
+ return null;
20
+ }
21
+ }
@@ -0,0 +1,15 @@
1
+ import java.util.List;
2
+
3
+ public class KindergartenGarden {
4
+ public KindergartenGarden(String garden, String[] students) {
5
+ throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
6
+ }
7
+
8
+ public KindergartenGarden(String garden) {
9
+ throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
10
+ }
11
+
12
+ public List<Plant> getPlantsOfStudent(String student) {
13
+ throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ public enum Plant {
2
+ VIOLETS,
3
+ RADISHES,
4
+ CLOVER,
5
+ GRASS;
6
+
7
+ public static Plant getPlant(char plantCode) {
8
+ switch (plantCode) {
9
+ case 'G':
10
+ return GRASS;
11
+ case 'C':
12
+ return CLOVER;
13
+ case 'R':
14
+ return RADISHES;
15
+ case 'V':
16
+ return VIOLETS;
17
+ }
18
+
19
+ return null;
20
+ }
21
+ }
@@ -0,0 +1,182 @@
1
+ import java.util.List;
2
+ import java.util.Arrays;
3
+
4
+ import org.junit.Test;
5
+ import org.junit.Ignore;
6
+
7
+ import static org.junit.Assert.assertEquals;
8
+
9
+ public class KindergartenGardenTest {
10
+
11
+ @Test
12
+ public void singleStudent() {
13
+ String student = "Alice";
14
+ String plants = "RC\nGG";
15
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.CLOVER, Plant.GRASS, Plant.GRASS);
16
+
17
+ assertEquals(
18
+ expected,
19
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
20
+ );
21
+ }
22
+
23
+ @Ignore("Remove to run test")
24
+ @Test
25
+ public void singleStudent2() {
26
+ String student = "Alice";
27
+ String plants = "VC\nRC";
28
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.CLOVER);
29
+
30
+ assertEquals(
31
+ expected,
32
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
33
+ );
34
+ }
35
+
36
+ @Ignore("Remove to run test")
37
+ @Test
38
+ public void twoStudents() {
39
+ String student = "Bob";
40
+ String plants = "VVCG\nVVRC";
41
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.RADISHES, Plant.CLOVER);
42
+
43
+ assertEquals(
44
+ expected,
45
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
46
+ );
47
+ }
48
+
49
+ @Ignore("Remove to run test")
50
+ @Test
51
+ public void oneGardenSecondStudent() {
52
+ String student = "Bob";
53
+ String plants = "VVCCGG\nVVCCGG";
54
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.CLOVER, Plant.CLOVER, Plant.CLOVER);
55
+
56
+ assertEquals(
57
+ expected,
58
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
59
+ );
60
+ }
61
+
62
+ @Ignore("Remove to run test")
63
+ @Test
64
+ public void oneGardenThirdStudent() {
65
+ String student = "Charlie";
66
+ String plants = "VVCCGG\nVVCCGG";
67
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.GRASS, Plant.GRASS, Plant.GRASS);
68
+
69
+ assertEquals(
70
+ expected,
71
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
72
+ );
73
+ }
74
+
75
+ @Ignore("Remove to run test")
76
+ @Test
77
+ public void fullGardenFirstStudent() {
78
+ String student = "Alice";
79
+ String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
80
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.RADISHES, Plant.VIOLETS, Plant.RADISHES);
81
+
82
+ assertEquals(
83
+ expected,
84
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
85
+ );
86
+ }
87
+
88
+ @Ignore("Remove to run test")
89
+ @Test
90
+ public void fullGardenSecondStudent() {
91
+ String student = "Bob";
92
+ String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
93
+ List<Plant> expected = Arrays.asList(Plant.CLOVER, Plant.GRASS, Plant.CLOVER, Plant.CLOVER);
94
+
95
+ assertEquals(
96
+ expected,
97
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
98
+ );
99
+ }
100
+
101
+ @Ignore("Remove to run test")
102
+ @Test
103
+ public void fullGardenSecondToLastStudent() {
104
+ String student = "Kincaid";
105
+ String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
106
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.CLOVER, Plant.CLOVER, Plant.GRASS);
107
+
108
+ assertEquals(
109
+ expected,
110
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
111
+ );
112
+ }
113
+
114
+ @Ignore("Remove to run test")
115
+ @Test
116
+ public void fullGardenLastStudent() {
117
+ String student = "Larry";
118
+ String plants = "VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV";
119
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.VIOLETS);
120
+
121
+ assertEquals(
122
+ expected,
123
+ new KindergartenGarden(plants).getPlantsOfStudent(student)
124
+ );
125
+ }
126
+
127
+ @Ignore("Remove to run test")
128
+ @Test
129
+ public void customStudentGardenFirstStudent() {
130
+ String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
131
+ String student = "Patricia";
132
+ String plants = "VCRRGVRG\nRVGCCGCV";
133
+ List<Plant> expected = Arrays.asList(Plant.VIOLETS, Plant.CLOVER, Plant.RADISHES, Plant.VIOLETS);
134
+
135
+ assertEquals(
136
+ expected,
137
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
138
+ );
139
+ }
140
+
141
+ @Ignore("Remove to run test")
142
+ @Test
143
+ public void customStudentGardenSecondStudent() {
144
+ String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
145
+ String student = "Roger";
146
+ String plants = "VCRRGVRG\nRVGCCGCV";
147
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.RADISHES, Plant.GRASS, Plant.CLOVER);
148
+
149
+ assertEquals(
150
+ expected,
151
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
152
+ );
153
+ }
154
+
155
+ @Ignore("Remove to run test")
156
+ @Test
157
+ public void customStudentGardenThirdStudent() {
158
+ String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
159
+ String student = "Samantha";
160
+ String plants = "VCRRGVRG\nRVGCCGCV";
161
+ List<Plant> expected = Arrays.asList(Plant.GRASS, Plant.VIOLETS, Plant.CLOVER, Plant.GRASS);
162
+
163
+ assertEquals(
164
+ expected,
165
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
166
+ );
167
+ }
168
+
169
+ @Ignore("Remove to run test")
170
+ @Test
171
+ public void customStudentGardenFourthStudent() {
172
+ String[] studentArray = {"Samantha", "Patricia", "Xander", "Roger"};
173
+ String student = "Xander";
174
+ String plants = "VCRRGVRG\nRVGCCGCV";
175
+ List<Plant> expected = Arrays.asList(Plant.RADISHES, Plant.GRASS, Plant.CLOVER, Plant.VIOLETS);
176
+
177
+ assertEquals(
178
+ expected,
179
+ new KindergartenGarden(plants, studentArray).getPlantsOfStudent(student)
180
+ );
181
+ }
182
+ }
@@ -1,34 +1,34 @@
1
- public class SumOfMultiples {
2
- private final int sum;
3
-
4
- public SumOfMultiples(int number, int[] set) {
5
- sum = calculateSum(number, set);
6
- }
7
-
8
- public int getSum() {
9
- return sum;
10
- }
11
-
12
- private int calculateSum(int number, int[] set) {
13
-
14
- int sum = 0;
15
- int count = 0;
16
-
17
- for (int i = 1; i < number; i++) {
18
-
19
- for (int j = 0; j < set.length; j++) {
20
- if (i % set[j] == 0) {
21
- count++;
22
- }
23
- }
24
-
25
- if (count > 0) {
26
- sum = sum + i;
27
- count = 0;
28
- }
29
- }
30
-
31
- return sum;
32
- }
33
-
34
- }
1
+ public class SumOfMultiples {
2
+ private final int sum;
3
+
4
+ public SumOfMultiples(int number, int[] set) {
5
+ sum = calculateSum(number, set);
6
+ }
7
+
8
+ public int getSum() {
9
+ return sum;
10
+ }
11
+
12
+ private int calculateSum(int number, int[] set) {
13
+
14
+ int sum = 0;
15
+ int count = 0;
16
+
17
+ for (int i = 1; i < number; i++) {
18
+
19
+ for (int j = 0; j < set.length; j++) {
20
+ if (i % set[j] == 0) {
21
+ count++;
22
+ }
23
+ }
24
+
25
+ if (count > 0) {
26
+ sum = sum + i;
27
+ count = 0;
28
+ }
29
+ }
30
+
31
+ return sum;
32
+ }
33
+
34
+ }
@@ -1,3 +1,3 @@
1
- public class SumOfMultiples {
2
-
3
- }
1
+ public class SumOfMultiples {
2
+
3
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trackler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.13
4
+ version: 2.1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katrina Owen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -4263,6 +4263,7 @@ files:
4263
4263
  - tracks/idris/img/icon.png
4264
4264
  - tracks/java/.Rhistory
4265
4265
  - tracks/java/.git
4266
+ - tracks/java/.gitattributes
4266
4267
  - tracks/java/.github/PULL_REQUEST_TEMPLATE.md
4267
4268
  - tracks/java/.github/stale.yml
4268
4269
  - tracks/java/.gitignore
@@ -4407,6 +4408,12 @@ files:
4407
4408
  - tracks/java/exercises/isogram/src/example/java/IsogramChecker.java
4408
4409
  - tracks/java/exercises/isogram/src/main/java/.keep
4409
4410
  - tracks/java/exercises/isogram/src/test/java/IsogramCheckerTest.java
4411
+ - tracks/java/exercises/kindergarten-garden/build.gradle
4412
+ - tracks/java/exercises/kindergarten-garden/src/example/java/KindergartenGarden.java
4413
+ - tracks/java/exercises/kindergarten-garden/src/example/java/Plant.java
4414
+ - tracks/java/exercises/kindergarten-garden/src/main/java/KindergartenGarden.java
4415
+ - tracks/java/exercises/kindergarten-garden/src/main/java/Plant.java
4416
+ - tracks/java/exercises/kindergarten-garden/src/test/java/KindergartenGardenTest.java
4410
4417
  - tracks/java/exercises/largest-series-product/build.gradle
4411
4418
  - tracks/java/exercises/largest-series-product/src/example/java/LargestSeriesProductCalculator.java
4412
4419
  - tracks/java/exercises/largest-series-product/src/main/java/LargestSeriesProductCalculator.java