trackler 2.1.0.27 → 2.1.0.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +9 -349
  3. data/common/exercises/forth/canonical-data.json +1 -7
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/bash/config.json +5 -0
  6. data/tracks/bash/exercises/anagram/anagram_tests.sh +99 -0
  7. data/tracks/bash/exercises/anagram/example.sh +23 -0
  8. data/tracks/delphi/config.json +8 -1
  9. data/tracks/delphi/exercises/two-fer/twofer.dpr +60 -0
  10. data/tracks/delphi/exercises/two-fer/utwoferExample.pas +17 -0
  11. data/tracks/delphi/exercises/two-fer/utwoferTest.pas +71 -0
  12. data/tracks/dlang/README.md +9 -5
  13. data/tracks/dlang/bin/test-exercise +14 -5
  14. data/tracks/dlang/docs/INSTALLATION.md +24 -0
  15. data/tracks/dlang/docs/TESTS.md +6 -6
  16. data/tracks/dlang/exercises/bob/dub.sdl +2 -0
  17. data/tracks/dlang/exercises/bob/{bob_example.d → example/bob.d} +0 -5
  18. data/tracks/dlang/exercises/bob/{bob.d → source/bob.d} +0 -5
  19. data/tracks/dlang/exercises/circular-buffer/dub.sdl +2 -0
  20. data/tracks/dlang/exercises/circular-buffer/{circular_buffer_example.d → example/circular_buffer.d} +0 -5
  21. data/tracks/dlang/exercises/circular-buffer/{circular_buffer.d → source/circular_buffer.d} +0 -5
  22. data/tracks/dlang/exercises/crypto-square/dub.sdl +2 -0
  23. data/tracks/dlang/exercises/crypto-square/{crypto_square_example.d → example/crypto_square.d} +0 -5
  24. data/tracks/dlang/exercises/crypto-square/{crypto_square.d → source/crypto_square.d} +0 -5
  25. data/tracks/dlang/exercises/difference-of-squares/dub.sdl +2 -0
  26. data/tracks/dlang/exercises/difference-of-squares/{difference_of_squares_example.d → example/difference_of_squares.d} +0 -2
  27. data/tracks/dlang/exercises/difference-of-squares/{difference_of_squares.d → source/difference_of_squares.d} +0 -2
  28. data/tracks/dlang/exercises/etl/dub.sdl +2 -0
  29. data/tracks/dlang/exercises/etl/{etl_example.d → example/etl.d} +0 -5
  30. data/tracks/dlang/exercises/etl/{etl.d → source/etl.d} +0 -5
  31. data/tracks/dlang/exercises/gigasecond/dub.sdl +2 -0
  32. data/tracks/dlang/exercises/gigasecond/{gigasecond_example.d → example/gigasecond.d} +0 -2
  33. data/tracks/dlang/exercises/gigasecond/{gigasecond.d → source/gigasecond.d} +0 -2
  34. data/tracks/dlang/exercises/hamming/dub.sdl +2 -0
  35. data/tracks/dlang/exercises/hamming/{hamming_example.d → example/hamming.d} +0 -5
  36. data/tracks/dlang/exercises/hamming/{hamming.d → source/hamming.d} +0 -5
  37. data/tracks/dlang/exercises/hello-world/dub.sdl +2 -0
  38. data/tracks/dlang/exercises/hello-world/{hello_world_example.d → example/hello_world.d} +0 -2
  39. data/tracks/dlang/exercises/hello-world/{hello_world.d → source/hello_world.d} +0 -0
  40. data/tracks/dlang/exercises/leap/dub.sdl +2 -0
  41. data/tracks/dlang/exercises/leap/{leap_example.d → example/leap.d} +0 -2
  42. data/tracks/dlang/exercises/leap/{leap.d → source/leap.d} +0 -2
  43. data/tracks/dlang/exercises/nucleotide-count/dub.sdl +2 -0
  44. data/tracks/dlang/exercises/nucleotide-count/{nucleotide_count_example.d → example/nucleotide_count.d} +0 -4
  45. data/tracks/dlang/exercises/nucleotide-count/{nucleotide_count.d → source/nucleotide_count.d} +0 -4
  46. data/tracks/dlang/exercises/pangram/dub.sdl +2 -0
  47. data/tracks/dlang/exercises/pangram/{pangram_example.d → example/pangram.d} +0 -2
  48. data/tracks/dlang/exercises/pangram/{pangram.d → source/pangram.d} +0 -2
  49. data/tracks/dlang/exercises/raindrops/dub.sdl +2 -0
  50. data/tracks/dlang/exercises/raindrops/{raindrops_example.d → example/raindrops.d} +0 -2
  51. data/tracks/dlang/exercises/raindrops/{raindrops.d → source/raindrops.d} +0 -2
  52. data/tracks/dlang/exercises/react/dub.sdl +2 -0
  53. data/tracks/dlang/exercises/react/{react_example.d → example/react.d} +0 -2
  54. data/tracks/dlang/exercises/react/{react.d → source/react.d} +0 -2
  55. data/tracks/dlang/exercises/rna-transcription/dub.sdl +2 -0
  56. data/tracks/dlang/exercises/rna-transcription/{rna_transcription_example.d → example/rna_transcription.d} +0 -2
  57. data/tracks/dlang/exercises/rna-transcription/{rna_transcription.d → source/rna_transcription.d} +0 -2
  58. data/tracks/dlang/exercises/robot-name/dub.sdl +2 -0
  59. data/tracks/dlang/exercises/robot-name/{robot_name_example.d → example/robot_name.d} +0 -5
  60. data/tracks/dlang/exercises/robot-name/{robot_name.d → source/robot_name.d} +0 -4
  61. data/tracks/dlang/exercises/roman-numerals/dub.sdl +2 -0
  62. data/tracks/dlang/exercises/roman-numerals/{roman_numerals_example.d → example/roman_numerals.d} +0 -4
  63. data/tracks/dlang/exercises/roman-numerals/{roman_numerals.d → source/roman_numerals.d} +0 -4
  64. data/tracks/dlang/exercises/series/dub.sdl +2 -0
  65. data/tracks/dlang/exercises/series/{series_example.d → example/series.d} +0 -5
  66. data/tracks/dlang/exercises/series/{series.d → source/series.d} +0 -5
  67. data/tracks/dlang/exercises/triangle/dub.sdl +2 -0
  68. data/tracks/dlang/exercises/triangle/{triangle_example.d → example/triangle.d} +0 -5
  69. data/tracks/dlang/exercises/triangle/{triangle.d → source/triangle.d} +0 -5
  70. data/tracks/elisp/.github/stale.yml +0 -0
  71. data/tracks/elisp/exercises/grains/grains-test.el +12 -12
  72. data/tracks/elisp/exercises/robot-name/robot-name-test.el +8 -19
  73. data/tracks/elisp/exercises/word-count/word-count-test.el +27 -27
  74. data/tracks/fortran/Makefile +3 -2
  75. data/tracks/fortran/config.json +21 -2
  76. data/tracks/fortran/exercises/difference-of-squares/difference_of_squares.fun +42 -0
  77. data/tracks/fortran/exercises/difference-of-squares/example.f90 +35 -0
  78. data/tracks/fortran/exercises/{hello_world → hello-world}/example.f90 +0 -0
  79. data/tracks/fortran/exercises/{hello_world → hello-world}/hello_world.fun +0 -0
  80. data/tracks/fortran/exercises/raindrops/example.f90 +26 -0
  81. data/tracks/fortran/exercises/raindrops/raindrops.fun +78 -0
  82. data/tracks/fortran/exercises/rna-transcription/example.f90 +27 -0
  83. data/tracks/fortran/exercises/rna-transcription/rna_transcription.fun +38 -0
  84. data/tracks/go/exercises/acronym/.meta/gen.go +51 -0
  85. data/tracks/go/exercises/acronym/acronym_test.go +1 -15
  86. data/tracks/go/exercises/acronym/cases_test.go +37 -0
  87. data/tracks/go/exercises/acronym/example.go +1 -1
  88. data/tracks/go/exercises/secret-handshake/.meta/gen.go +49 -0
  89. data/tracks/go/exercises/secret-handshake/cases_test.go +24 -0
  90. data/tracks/go/exercises/secret-handshake/example.go +1 -1
  91. data/tracks/go/exercises/secret-handshake/secret_handshake_test.go +1 -17
  92. data/tracks/java/config.json +23 -23
  93. data/tracks/java/exercises/book-store/src/example/java/{Bookstore.java → BookStore.java} +5 -12
  94. data/tracks/java/exercises/book-store/src/test/java/BookStoreTest.java +113 -0
  95. data/tracks/java/exercises/saddle-points/src/example/java/Matrix.java +5 -4
  96. data/tracks/java/exercises/saddle-points/src/example/java/MatrixCoordinate.java +5 -5
  97. data/tracks/java/exercises/saddle-points/src/main/java/MatrixCoordinate.java +5 -5
  98. data/tracks/java/exercises/saddle-points/src/test/java/MatrixTest.java +10 -10
  99. data/tracks/purescript/config.json +7 -0
  100. data/tracks/purescript/exercises/hamming/bower.json +16 -0
  101. data/tracks/purescript/exercises/hamming/examples/src/Hamming.purs +14 -0
  102. data/tracks/purescript/exercises/hamming/test/Main.purs +46 -0
  103. data/tracks/scala/config.json +7 -0
  104. data/tracks/scala/exercises/bob/example.scala +3 -3
  105. data/tracks/scala/exercises/bob/src/main/scala/Bob.scala +2 -2
  106. data/tracks/scala/exercises/bob/src/test/scala/BobTest.scala +83 -53
  107. data/tracks/scala/exercises/book-store/build.sbt +3 -0
  108. data/tracks/scala/exercises/book-store/example.scala +49 -0
  109. data/tracks/scala/exercises/book-store/src/main/scala/.keep +0 -0
  110. data/tracks/scala/exercises/book-store/src/test/scala/BookStoreTest.scala +70 -0
  111. data/tracks/scala/exercises/difference-of-squares/example.scala +3 -3
  112. data/tracks/scala/exercises/difference-of-squares/src/main/scala/DifferenceOfSquares.scala +8 -0
  113. data/tracks/scala/exercises/difference-of-squares/src/test/scala/DifferenceOfSquaresTest.scala +49 -0
  114. data/tracks/scala/exercises/leap/example.scala +4 -3
  115. data/tracks/scala/exercises/leap/src/main/scala/Leap.scala +2 -2
  116. data/tracks/scala/exercises/leap/src/test/scala/LeapTest.scala +12 -20
  117. data/tracks/scala/exercises/raindrops/src/test/scala/RaindropsTest.scala +46 -35
  118. data/tracks/scala/testgen/src/main/scala/BobTestGenerator.scala +15 -0
  119. data/tracks/scala/testgen/src/main/scala/BookStoreTestGenerator.scala +15 -0
  120. data/tracks/scala/testgen/src/main/scala/DifferenceOfSquaresTestGenerator.scala +17 -0
  121. data/tracks/scala/testgen/src/main/scala/LeapTestGenerator.scala +15 -0
  122. data/tracks/scala/testgen/src/main/scala/RaindropsTestGenerator.scala +15 -0
  123. data/tracks/vimscript/config.json +5 -0
  124. data/tracks/vimscript/exercises/triangle/example.vim +28 -0
  125. data/tracks/vimscript/exercises/triangle/triangle.vader +92 -0
  126. data/tracks/vimscript/exercises/triangle/triangle.vim +24 -0
  127. metadata +93 -44
  128. data/tracks/java/exercises/book-store/src/test/java/BookstoreTest.java +0 -119
  129. data/tracks/scala/exercises/difference-of-squares/src/main/scala/Squares.scala +0 -8
  130. data/tracks/scala/exercises/difference-of-squares/src/test/scala/SquaresTest.scala +0 -56
@@ -1,6 +1,6 @@
1
1
  package secret
2
2
 
3
- const testVersion = 1
3
+ const testVersion = 2
4
4
 
5
5
  var signals = []string{"wink", "double blink", "close your eyes", "jump"}
6
6
 
@@ -5,23 +5,7 @@ import (
5
5
  "testing"
6
6
  )
7
7
 
8
- const targetTestVersion = 1
9
-
10
- var tests = []struct {
11
- code uint
12
- h []string
13
- }{
14
- {1, []string{"wink"}},
15
- {2, []string{"double blink"}},
16
- {4, []string{"close your eyes"}},
17
- {8, []string{"jump"}},
18
- {3, []string{"wink", "double blink"}},
19
- {19, []string{"double blink", "wink"}},
20
- {31, []string{"jump", "close your eyes", "double blink", "wink"}},
21
- {0, nil},
22
- {32, nil},
23
- {33, []string{"wink"}},
24
- }
8
+ const targetTestVersion = 2
25
9
 
26
10
  func TestTestVersion(t *testing.T) {
27
11
  if testVersion != targetTestVersion {
@@ -60,6 +60,11 @@
60
60
  "difficulty": 3,
61
61
  "topics": []
62
62
  },
63
+ {
64
+ "slug": "perfect-numbers",
65
+ "difficulty": 3,
66
+ "topics": []
67
+ },
63
68
  {
64
69
  "slug": "sum-of-multiples",
65
70
  "difficulty": 4,
@@ -105,6 +110,11 @@
105
110
  "difficulty": 4,
106
111
  "topics": []
107
112
  },
113
+ {
114
+ "slug": "saddle-points",
115
+ "difficulty": 4,
116
+ "topics": []
117
+ },
108
118
  {
109
119
  "slug": "diamond",
110
120
  "difficulty": 4,
@@ -271,38 +281,38 @@
271
281
  "topics": []
272
282
  },
273
283
  {
274
- "slug": "simple-cipher",
275
- "difficulty": 8,
284
+ "slug": "clock",
285
+ "difficulty": 7,
276
286
  "topics": []
277
287
  },
278
288
  {
279
- "slug": "palindrome-products",
289
+ "slug": "book-store",
280
290
  "difficulty": 8,
281
291
  "topics": []
282
292
  },
283
293
  {
284
- "slug": "pythagorean-triplet",
285
- "difficulty": 9,
294
+ "slug": "simple-cipher",
295
+ "difficulty": 8,
286
296
  "topics": []
287
297
  },
288
298
  {
289
- "slug": "custom-set",
290
- "difficulty": 10,
299
+ "slug": "change",
300
+ "difficulty": 8,
291
301
  "topics": []
292
302
  },
293
303
  {
294
- "slug": "clock",
295
- "difficulty": 1,
304
+ "slug": "palindrome-products",
305
+ "difficulty": 8,
296
306
  "topics": []
297
307
  },
298
308
  {
299
- "slug": "perfect-numbers",
300
- "difficulty": 1,
309
+ "slug": "pythagorean-triplet",
310
+ "difficulty": 9,
301
311
  "topics": []
302
312
  },
303
313
  {
304
- "slug": "change",
305
- "difficulty": 1,
314
+ "slug": "custom-set",
315
+ "difficulty": 10,
306
316
  "topics": []
307
317
  },
308
318
  {
@@ -315,16 +325,6 @@
315
325
  "difficulty": 1,
316
326
  "topics": []
317
327
  },
318
- {
319
- "slug": "book-store",
320
- "difficulty": 1,
321
- "topics": []
322
- },
323
- {
324
- "slug": "saddle-points",
325
- "difficulty": 1,
326
- "topics": []
327
- },
328
328
  {
329
329
  "slug": "run-length-encoding",
330
330
  "difficulty": 1,
@@ -2,23 +2,17 @@ import java.util.ArrayList;
2
2
  import java.util.List;
3
3
  import java.util.stream.Collectors;
4
4
 
5
- class Bookstore {
5
+ class BookStore {
6
6
 
7
7
  private static final int BOOK_PRICE = 8, MAX_GROUP_SIZE = 5;
8
8
 
9
9
  private static double[] DISCOUNT_TIERS = {0, 5, 10, 20, 25};
10
10
 
11
- private List<Integer> books;
12
-
13
- Bookstore(List<Integer> books) {
14
- this.books = books;
15
- }
16
-
17
- double calculateTotalCost() {
18
- return calculateTotalCost(this.books, 0);
11
+ double calculateBasketCost(final List<Integer> books) {
12
+ return calculateBasketCost(books, 0);
19
13
  }
20
14
 
21
- private double calculateTotalCost(List<Integer> books, double priceSoFar) {
15
+ private double calculateBasketCost(final List<Integer> books, final double priceSoFar) {
22
16
  if (books.size() == 0) {
23
17
  return priceSoFar;
24
18
  }
@@ -38,8 +32,7 @@ class Bookstore {
38
32
  remainingBooks.remove(newGroupBook);
39
33
  }
40
34
 
41
- double price = calculateTotalCost(remainingBooks, priceSoFar + costOfGroupSize(newGroupBooks.size()));
42
-
35
+ double price = calculateBasketCost(remainingBooks, priceSoFar + costOfGroupSize(newGroupBooks.size()));
43
36
  minPrice = Math.min(minPrice, price);
44
37
  }
45
38
 
@@ -0,0 +1,113 @@
1
+ import static org.junit.Assert.assertEquals;
2
+
3
+ import java.util.Collections;
4
+ import java.util.List;
5
+ import java.util.Arrays;
6
+
7
+ import org.junit.Before;
8
+ import org.junit.Ignore;
9
+ import org.junit.Test;
10
+
11
+ public class BookStoreTest {
12
+
13
+ // This is sufficient accuracy since we're handling currency values, which should be equal to within 2 decimal places.
14
+ private static final double EQUALITY_TOLERANCE = 0.001;
15
+
16
+ private BookStore bookStore;
17
+
18
+ @Before
19
+ public void setUp() {
20
+ bookStore = new BookStore();
21
+ }
22
+
23
+ @Test
24
+ public void onlyASingleBook() {
25
+ List<Integer> books = Collections.singletonList(1);
26
+ assertEquals(8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
27
+ }
28
+
29
+ @Ignore("Remove to run test")
30
+ @Test
31
+ public void twoOfSameBook() {
32
+ List<Integer> books = Arrays.asList(1, 1);
33
+ assertEquals(16, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
34
+ }
35
+
36
+ @Ignore("Remove to run test")
37
+ @Test
38
+ public void emptyBasket() {
39
+ List<Integer> books = Collections.emptyList();
40
+ assertEquals(0, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
41
+ }
42
+
43
+ @Ignore("Remove to run test")
44
+ @Test
45
+ public void twoDifferentBooks() {
46
+ List<Integer> books = Arrays.asList(1, 2);
47
+ assertEquals(15.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
48
+ }
49
+
50
+ @Ignore("Remove to run test")
51
+ @Test
52
+ public void threeDifferentBooks() {
53
+ List<Integer> books = Arrays.asList(1, 2, 3);
54
+ assertEquals(21.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
55
+ }
56
+
57
+ @Ignore("Remove to run test")
58
+ @Test
59
+ public void fourDifferentBooks() {
60
+ List<Integer> books = Arrays.asList(1, 2, 3, 4);
61
+ assertEquals(25.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
62
+ }
63
+
64
+ @Ignore("Remove to run test")
65
+ @Test
66
+ public void fiveDifferentBooks() {
67
+ List<Integer> books = Arrays.asList(1, 2, 3, 4, 5);
68
+ assertEquals(30, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
69
+ }
70
+
71
+ @Ignore("Remove to run test")
72
+ @Test
73
+ public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree() {
74
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5);
75
+ assertEquals(51.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
76
+ }
77
+
78
+ @Ignore("Remove to run test")
79
+ @Test
80
+ public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
81
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 4);
82
+ assertEquals(40.8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
83
+ }
84
+
85
+ @Ignore("Remove to run test")
86
+ @Test
87
+ public void twoEachOfFirst4BooksAnd1CopyEachOfRest() {
88
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5);
89
+ assertEquals(55.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
90
+ }
91
+
92
+ @Ignore("Remove to run test")
93
+ @Test
94
+ public void twoCopiesOfEachBook() {
95
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5);
96
+ assertEquals(60.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
97
+ }
98
+
99
+ @Ignore("Remove to run test")
100
+ @Test
101
+ public void threeCopiesOfFirstBookAnd2EachOfRemaining() {
102
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1);
103
+ assertEquals(68.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
104
+ }
105
+
106
+ @Ignore("Remove to run test")
107
+ @Test
108
+ public void threeEachOFirst2BooksAnd2EachOfRemainingBooks() {
109
+ List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2);
110
+ assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
111
+ }
112
+
113
+ }
@@ -1,6 +1,7 @@
1
- import java.util.ArrayList;
2
1
  import java.util.Collections;
2
+ import java.util.HashSet;
3
3
  import java.util.List;
4
+ import java.util.Set;
4
5
 
5
6
  final class Matrix {
6
7
 
@@ -10,8 +11,8 @@ final class Matrix {
10
11
  this.values = values;
11
12
  }
12
13
 
13
- List<MatrixCoordinate> getSaddlePoints() {
14
- final List<MatrixCoordinate> result = new ArrayList<>();
14
+ Set<MatrixCoordinate> getSaddlePoints() {
15
+ final Set<MatrixCoordinate> result = new HashSet<>();
15
16
 
16
17
  if (values.isEmpty()) {
17
18
  return result;
@@ -38,7 +39,7 @@ final class Matrix {
38
39
  return values.stream()
39
40
  .map(row -> row.get(column))
40
41
  .min(Integer::compareTo)
41
- .get();
42
+ .orElseThrow(() -> new IllegalArgumentException("Column cannot be empty"));
42
43
  }
43
44
 
44
45
  }
@@ -2,11 +2,11 @@ final class MatrixCoordinate {
2
2
 
3
3
  private final int row;
4
4
 
5
- private final int column;
5
+ private final int col;
6
6
 
7
- MatrixCoordinate(final int row, final int column) {
7
+ MatrixCoordinate(final int row, final int col) {
8
8
  this.row = row;
9
- this.column = column;
9
+ this.col = col;
10
10
  }
11
11
 
12
12
  // Generated equals and hashcode.
@@ -18,13 +18,13 @@ final class MatrixCoordinate {
18
18
 
19
19
  final MatrixCoordinate that = (MatrixCoordinate) o;
20
20
 
21
- return row == that.row && column == that.column;
21
+ return row == that.row && col == that.col;
22
22
  }
23
23
 
24
24
  @Override
25
25
  public int hashCode() {
26
26
  int result = row;
27
- result = 31 * result + column;
27
+ result = 31 * result + col;
28
28
  return result;
29
29
  }
30
30
 
@@ -2,11 +2,11 @@ final class MatrixCoordinate {
2
2
 
3
3
  private final int row;
4
4
 
5
- private final int column;
5
+ private final int col;
6
6
 
7
- MatrixCoordinate(final int row, final int column) {
7
+ MatrixCoordinate(final int row, final int col) {
8
8
  this.row = row;
9
- this.column = column;
9
+ this.col = col;
10
10
  }
11
11
 
12
12
  // Generated equals and hashcode.
@@ -18,13 +18,13 @@ final class MatrixCoordinate {
18
18
 
19
19
  final MatrixCoordinate that = (MatrixCoordinate) o;
20
20
 
21
- return row == that.row && column == that.column;
21
+ return row == that.row && col == that.col;
22
22
  }
23
23
 
24
24
  @Override
25
25
  public int hashCode() {
26
26
  int result = row;
27
- result = 31 * result + column;
27
+ result = 31 * result + col;
28
28
  return result;
29
29
  }
30
30
 
@@ -1,13 +1,13 @@
1
1
  import org.junit.Ignore;
2
2
  import org.junit.Test;
3
3
 
4
- import java.util.ArrayList;
5
- import java.util.Arrays;
6
- import java.util.Collections;
7
- import java.util.List;
4
+ import java.util.*;
8
5
 
9
6
  import static org.junit.Assert.assertEquals;
10
7
 
8
+ /*
9
+ * version: 1.0.0
10
+ */
11
11
  public class MatrixTest {
12
12
 
13
13
  @Test
@@ -18,7 +18,7 @@ public class MatrixTest {
18
18
  Arrays.asList(6, 6, 7)
19
19
  ));
20
20
 
21
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(1, 0));
21
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(1, 0));
22
22
 
23
23
  assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
24
24
  }
@@ -28,7 +28,7 @@ public class MatrixTest {
28
28
  public void testCanIdentifyThatEmptyMatrixHasNoSaddlePoints() {
29
29
  Matrix matrix = new Matrix(new ArrayList<>());
30
30
 
31
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
31
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
32
32
 
33
33
  assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
34
34
  }
@@ -42,7 +42,7 @@ public class MatrixTest {
42
42
  Arrays.asList(2, 3, 1)
43
43
  ));
44
44
 
45
- List<MatrixCoordinate> expectedSaddlePoints = new ArrayList<>();
45
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.emptySet();
46
46
 
47
47
  assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
48
48
  }
@@ -56,11 +56,11 @@ public class MatrixTest {
56
56
  Arrays.asList(1, 5, 4)
57
57
  ));
58
58
 
59
- List<MatrixCoordinate> expectedSaddlePoints = Arrays.asList(
59
+ Set<MatrixCoordinate> expectedSaddlePoints = new HashSet<>(Arrays.asList(
60
60
  new MatrixCoordinate(0, 1),
61
61
  new MatrixCoordinate(1, 1),
62
62
  new MatrixCoordinate(2, 1)
63
- );
63
+ ));
64
64
 
65
65
  assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
66
66
  }
@@ -74,7 +74,7 @@ public class MatrixTest {
74
74
  Arrays.asList(3, 2, 5)
75
75
  ));
76
76
 
77
- List<MatrixCoordinate> expectedSaddlePoints = Collections.singletonList(new MatrixCoordinate(2, 2));
77
+ Set<MatrixCoordinate> expectedSaddlePoints = Collections.singleton(new MatrixCoordinate(2, 2));
78
78
 
79
79
  assertEquals(expectedSaddlePoints, matrix.getSaddlePoints());
80
80
  }
@@ -32,6 +32,13 @@
32
32
  "modulo"
33
33
  ]
34
34
  },
35
+ {
36
+ "slug": "hamming",
37
+ "difficulty": 1,
38
+ "topics": [
39
+ "Iterating over two lists at once"
40
+ ]
41
+ },
35
42
  {
36
43
  "slug": "pangram",
37
44
  "difficulty": 1,