trackler 2.2.1.15 → 2.2.1.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/TOPICS.txt +8 -1
  4. data/tracks/c/docs/SNIPPET.txt +11 -0
  5. data/tracks/ceylon/docs/SNIPPET.txt +3 -0
  6. data/tracks/clojure/docs/SNIPPET.txt +5 -0
  7. data/tracks/csharp/build.cake +23 -16
  8. data/tracks/csharp/build.ps1 +1 -1
  9. data/tracks/csharp/build.sh +1 -1
  10. data/tracks/csharp/exercises/pangram/PangramTest.cs +9 -18
  11. data/tracks/csharp/generators/.gitignore +2 -1
  12. data/tracks/csharp/generators/Exercise.cs +11 -12
  13. data/tracks/csharp/generators/Exercises/AllYourBase.cs +2 -2
  14. data/tracks/csharp/generators/Exercises/Allergies.cs +1 -1
  15. data/tracks/csharp/generators/Exercises/Alphametics.cs +1 -1
  16. data/tracks/csharp/generators/Exercises/Anagram.cs +1 -1
  17. data/tracks/csharp/generators/Exercises/BeerSong.cs +1 -1
  18. data/tracks/csharp/generators/Exercises/BinarySearch.cs +1 -1
  19. data/tracks/csharp/generators/Exercises/BookStore.cs +1 -1
  20. data/tracks/csharp/generators/Exercises/BracketPush.cs +1 -1
  21. data/tracks/csharp/generators/Exercises/CollatzConjecture.cs +2 -2
  22. data/tracks/csharp/generators/Exercises/CryptoSquare.cs +1 -1
  23. data/tracks/csharp/generators/Exercises/FoodChain.cs +1 -1
  24. data/tracks/csharp/generators/Exercises/Gigasecond.cs +1 -1
  25. data/tracks/csharp/generators/Exercises/Hamming.cs +1 -1
  26. data/tracks/csharp/generators/Exercises/House.cs +1 -1
  27. data/tracks/csharp/generators/Exercises/Leap.cs +1 -1
  28. data/tracks/csharp/generators/Exercises/Luhn.cs +1 -1
  29. data/tracks/csharp/generators/Exercises/NthPrime.cs +1 -1
  30. data/tracks/csharp/generators/Exercises/Pangram.cs +1 -11
  31. data/tracks/csharp/generators/Exercises/PerfectNumbers.cs +1 -1
  32. data/tracks/csharp/generators/Exercises/PhoneNumber.cs +1 -1
  33. data/tracks/csharp/generators/Exercises/RailFenceCipher.cs +1 -1
  34. data/tracks/csharp/generators/Exercises/RnaTranscription.cs +1 -1
  35. data/tracks/csharp/generators/Exercises/RomanNumerals.cs +1 -1
  36. data/tracks/csharp/generators/Exercises/RunLengthEncoding.cs +1 -1
  37. data/tracks/csharp/generators/Exercises/Say.cs +2 -7
  38. data/tracks/csharp/generators/Exercises/SecretHandshake.cs +1 -1
  39. data/tracks/csharp/generators/Exercises/Sieve.cs +1 -1
  40. data/tracks/csharp/generators/Exercises/SpaceAge.cs +1 -1
  41. data/tracks/csharp/generators/Exercises/SumOfMultiples.cs +1 -1
  42. data/tracks/csharp/generators/Exercises/Transpose.cs +1 -1
  43. data/tracks/csharp/generators/Exercises/WordCount.cs +1 -1
  44. data/tracks/csharp/generators/Exercises/Wordy.cs +1 -1
  45. data/tracks/csharp/generators/Output/FormattingExtensions.cs +4 -2
  46. data/tracks/csharp/generators/Output/ValueFormatter.cs +1 -1
  47. data/tracks/delphi/docs/SNIPPET.txt +6 -13
  48. data/tracks/ecmascript/docs/SNIPPET.txt +7 -0
  49. data/tracks/elisp/docs/SNIPPET.txt +13 -0
  50. data/tracks/elixir/config.json +2 -2
  51. data/tracks/elixir/docs/SNIPPET.txt +10 -0
  52. data/tracks/erlang/docs/SNIPPET.txt +8 -0
  53. data/tracks/fsharp/docs/SNIPPET.txt +3 -0
  54. data/tracks/go/config.json +174 -174
  55. data/tracks/go/config/maintainers.json +6 -9
  56. data/tracks/go/docs/SNIPPET.txt +6 -0
  57. data/tracks/groovy/config.json +4 -4
  58. data/tracks/groovy/docs/SNIPPET.txt +12 -0
  59. data/tracks/haskell/config.json +2 -0
  60. data/tracks/haskell/docs/SNIPPET.txt +4 -0
  61. data/tracks/java/docs/SNIPPET.txt +7 -0
  62. data/tracks/java/exercises/robot-simulator/src/example/java/GridPosition.java +21 -16
  63. data/tracks/java/exercises/robot-simulator/src/test/java/RobotTest.java +24 -24
  64. data/tracks/javascript/docs/SNIPPET.txt +10 -0
  65. data/tracks/kotlin/docs/SNIPPET.txt +3 -0
  66. data/tracks/kotlin/exercises/change/src/example/kotlin/ChangeCalculator.kt +35 -0
  67. data/tracks/kotlin/exercises/change/src/test/kotlin/ChangeCalculatorTest.kt +105 -0
  68. data/tracks/lfe/docs/SNIPPET.txt +12 -0
  69. data/tracks/lua/docs/SNIPPET.txt +7 -0
  70. data/tracks/mips/docs/SNIPPET.txt +23 -0
  71. data/tracks/ocaml/docs/SNIPPET.txt +1 -0
  72. data/tracks/purescript/config.json +1 -1
  73. data/tracks/purescript/docs/SNIPPET.txt +8 -0
  74. data/tracks/python/exercises/saddle-points/README.md +1 -1
  75. data/tracks/racket/docs/SNIPPET.txt +6 -0
  76. data/tracks/ruby/docs/SNIPPET.txt +5 -0
  77. data/tracks/rust/docs/SNIPPET.txt +3 -0
  78. data/tracks/scala/docs/SNIPPET.txt +4 -0
  79. data/tracks/scala/exercises/ocr-numbers/example.scala +17 -11
  80. data/tracks/scala/exercises/ocr-numbers/src/test/scala/OcrNumbersTest.scala +153 -0
  81. data/tracks/scala/exercises/pig-latin/example.scala +11 -6
  82. data/tracks/scala/exercises/pig-latin/src/test/scala/PigLatinTest.scala +80 -10
  83. data/tracks/scala/testgen/src/main/scala/OcrNumbersTestGenerator.scala +34 -0
  84. data/tracks/scala/testgen/src/main/scala/PigLatinTestGenerator.scala +16 -0
  85. data/tracks/scheme/docs/SNIPPET.txt +7 -0
  86. data/tracks/sml/bin/generate +277 -0
  87. data/tracks/sml/config.json +30 -0
  88. data/tracks/sml/docs/ABOUT.md +32 -0
  89. data/tracks/sml/docs/LEARNING.md +37 -0
  90. data/tracks/sml/docs/SNIPPET.txt +3 -0
  91. data/tracks/sml/exercises/bob/README.md +48 -0
  92. data/tracks/sml/exercises/bob/bob.sml +2 -0
  93. data/tracks/sml/exercises/bob/example.sml +22 -0
  94. data/tracks/sml/exercises/bob/test.sml +87 -0
  95. data/tracks/sml/exercises/bob/testlib.sml +159 -0
  96. data/tracks/sml/exercises/difference-of-squares/README.md +49 -0
  97. data/tracks/sml/exercises/difference-of-squares/difference-of-squares.sml +8 -0
  98. data/tracks/sml/exercises/difference-of-squares/example.sml +11 -0
  99. data/tracks/sml/exercises/difference-of-squares/test.sml +45 -0
  100. data/tracks/sml/exercises/difference-of-squares/testlib.sml +159 -0
  101. data/tracks/sml/exercises/hello-world/README.md +51 -0
  102. data/tracks/sml/exercises/hello-world/example.sml +1 -0
  103. data/tracks/sml/exercises/hello-world/hello-world.sml +2 -0
  104. data/tracks/sml/exercises/hello-world/test.sml +15 -0
  105. data/tracks/sml/exercises/hello-world/testlib.sml +159 -0
  106. data/tracks/sml/lib/testlib.sml +159 -0
  107. data/tracks/swift/docs/SNIPPET.txt +9 -0
  108. data/tracks/typescript/docs/SNIPPET.txt +8 -0
  109. metadata +53 -6
  110. data/tracks/csharp/generators/Generators.csproj.user +0 -6
  111. data/tracks/kotlin/exercises/change/src/example/kotlin/Change.kt +0 -70
  112. data/tracks/kotlin/exercises/change/src/test/kotlin/ChangeTest.kt +0 -55
  113. data/tracks/scala/exercises/ocr-numbers/src/test/scala/OcrTest.scala +0 -138
@@ -15,17 +15,14 @@
15
15
  "alumnus": true,
16
16
  "bio": "I love Go for its simplicity and consistency. I also appreciate how hard the Go project is working to make the ecosystem welcoming to newcomers. I no longer maintain the Go track, but still maintain the Go tooling on Exercism.",
17
17
  "github_username": "kytrinyx",
18
- "name": "Katrina Owen"
18
+ "name": "Katrina Owen",
19
+ "show_on_website": true
19
20
  },
20
21
  {
21
- "alumnus": false,
22
- "avatar_url": null,
23
- "bio": null,
22
+ "alumnus": true,
23
+ "bio": "I write a lot of Go for my day job, building platforms for other software engineers to use. The Exercism Go track was the first open-source project I joined; I'm grateful for all I've learned through this experience.",
24
24
  "github_username": "petertseng",
25
- "link_text": null,
26
- "link_url": null,
27
- "name": null,
28
- "show_on_website": false
25
+ "show_on_website": true
29
26
  },
30
27
  {
31
28
  "alumnus": false,
@@ -75,4 +72,4 @@
75
72
  "show_on_website": true
76
73
  }
77
74
  ]
78
- }
75
+ }
@@ -0,0 +1,6 @@
1
+ package greeting
2
+
3
+ // HelloWorld greets the world.
4
+ func HelloWorld() string {
5
+ return "Hello, World!"
6
+ }
@@ -44,7 +44,7 @@
44
44
  "unlocked_by": null,
45
45
  "difficulty": 3,
46
46
  "topics": [
47
- "math",
47
+ "mathematics",
48
48
  "strings"
49
49
  ]
50
50
  },
@@ -65,7 +65,7 @@
65
65
  "unlocked_by": null,
66
66
  "difficulty": 2,
67
67
  "topics": [
68
- "math"
68
+ "mathematics"
69
69
  ]
70
70
  },
71
71
  {
@@ -96,7 +96,7 @@
96
96
  "unlocked_by": null,
97
97
  "difficulty": 4,
98
98
  "topics": [
99
- "math"
99
+ "mathematics"
100
100
  ]
101
101
  },
102
102
  {
@@ -127,7 +127,7 @@
127
127
  "unlocked_by": null,
128
128
  "difficulty": 2,
129
129
  "topics": [
130
- "math"
130
+ "mathematics"
131
131
  ]
132
132
  },
133
133
  {
@@ -0,0 +1,12 @@
1
+ class Greeter {
2
+ def name
3
+
4
+ Greeter(String name) {
5
+ this.name = name
6
+ }
7
+
8
+ def greet() {
9
+ print "Hello, ${name}!"
10
+ }
11
+ }
12
+ new Greeter('World').greet()
@@ -1,6 +1,8 @@
1
1
  {
2
2
  "language": "Haskell",
3
3
  "active": true,
4
+ "solution_pattern": "example.*[.]hs",
5
+ "ignore_pattern": "example",
4
6
  "exercises": [
5
7
  {
6
8
  "uuid": "c97d9dda-c7ee-4595-b447-693559d03ba5",
@@ -0,0 +1,4 @@
1
+ module HelloWorld (hello) where
2
+
3
+ hello :: String
4
+ hello = "Hello, World!"
@@ -0,0 +1,7 @@
1
+ class Greeter {
2
+
3
+ String getGreeting() {
4
+ return "Hello, World!";
5
+ }
6
+
7
+ }
@@ -9,21 +9,26 @@ final class GridPosition {
9
9
  this.y = y;
10
10
  }
11
11
 
12
- /*
13
- * This equals method is of deliberately narrow scope (only allows comparison with another GridPosition) to increase
14
- * readability. In general, one should provide a full implementation of Object.equals(Object obj) and a
15
- * corresponding implementation of Object.hashCode(). See
16
- *
17
- * https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#equals(java.lang.Object)
18
- *
19
- * and
20
- *
21
- * https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode()
22
- *
23
- * for more information.
24
- */
25
- boolean equals(final GridPosition gridPosition) {
26
- return this.x == gridPosition.x && this.y == gridPosition.y;
27
- }
12
+ @Override
13
+ public int hashCode() {
14
+ final int prime = 31;
15
+ int result = 1;
16
+ result = prime * result + x;
17
+ result = prime * result + y;
18
+ return result;
19
+ }
20
+
21
+ @Override
22
+ public boolean equals(Object obj) {
23
+ if (this == obj) {
24
+ return true;
25
+ } else if (obj == null || getClass() != obj.getClass()) {
26
+ return false;
27
+ } else if (x != ((GridPosition) obj).x || y != ((GridPosition)obj).y) {
28
+ return false;
29
+ } else {
30
+ return true;
31
+ }
32
+ }
28
33
 
29
34
  }
@@ -1,7 +1,7 @@
1
1
  import org.junit.Ignore;
2
2
  import org.junit.Test;
3
3
 
4
- import static org.junit.Assert.assertTrue;
4
+ import static org.junit.Assert.assertEquals;
5
5
 
6
6
  public class RobotTest {
7
7
 
@@ -10,7 +10,7 @@ public class RobotTest {
10
10
  final GridPosition initialGridPosition = new GridPosition(0, 0);
11
11
  final Robot robot = new Robot(initialGridPosition, Orientation.NORTH);
12
12
 
13
- assertTrue(robot.getGridPosition().equals(initialGridPosition));
13
+ assertEquals(robot.getGridPosition(), initialGridPosition);
14
14
  }
15
15
 
16
16
  @Ignore("Remove to run test")
@@ -19,7 +19,7 @@ public class RobotTest {
19
19
  final Orientation initialOrientation = Orientation.NORTH;
20
20
  final Robot robot = new Robot(new GridPosition(0, 0), initialOrientation);
21
21
 
22
- assertTrue(robot.getOrientation().equals(initialOrientation));
22
+ assertEquals(robot.getOrientation(), initialOrientation);
23
23
  }
24
24
 
25
25
  @Ignore("Remove to run test")
@@ -30,7 +30,7 @@ public class RobotTest {
30
30
 
31
31
  robot.turnRight();
32
32
 
33
- assertTrue(robot.getGridPosition().equals(initialGridPosition));
33
+ assertEquals(robot.getGridPosition(), initialGridPosition);
34
34
  }
35
35
 
36
36
  @Ignore("Remove to run test")
@@ -42,7 +42,7 @@ public class RobotTest {
42
42
 
43
43
  final Orientation expectedOrientation = Orientation.EAST;
44
44
 
45
- assertTrue(robot.getOrientation().equals(expectedOrientation));
45
+ assertEquals(robot.getOrientation(), expectedOrientation);
46
46
  }
47
47
 
48
48
  @Ignore("Remove to run test")
@@ -54,7 +54,7 @@ public class RobotTest {
54
54
 
55
55
  final Orientation expectedOrientation = Orientation.SOUTH;
56
56
 
57
- assertTrue(robot.getOrientation().equals(expectedOrientation));
57
+ assertEquals(robot.getOrientation(), expectedOrientation);
58
58
  }
59
59
 
60
60
  @Ignore("Remove to run test")
@@ -66,7 +66,7 @@ public class RobotTest {
66
66
 
67
67
  final Orientation expectedOrientation = Orientation.WEST;
68
68
 
69
- assertTrue(robot.getOrientation().equals(expectedOrientation));
69
+ assertEquals(robot.getOrientation(), expectedOrientation);
70
70
  }
71
71
 
72
72
  @Ignore("Remove to run test")
@@ -78,7 +78,7 @@ public class RobotTest {
78
78
 
79
79
  final Orientation expectedOrientation = Orientation.NORTH;
80
80
 
81
- assertTrue(robot.getOrientation().equals(expectedOrientation));
81
+ assertEquals(robot.getOrientation(), expectedOrientation);
82
82
  }
83
83
 
84
84
  @Ignore("Remove to run test")
@@ -89,7 +89,7 @@ public class RobotTest {
89
89
 
90
90
  robot.turnLeft();
91
91
 
92
- assertTrue(robot.getGridPosition().equals(initialGridPosition));
92
+ assertEquals(robot.getGridPosition(), initialGridPosition);
93
93
  }
94
94
 
95
95
  @Ignore("Remove to run test")
@@ -101,7 +101,7 @@ public class RobotTest {
101
101
 
102
102
  final Orientation expectedOrientation = Orientation.WEST;
103
103
 
104
- assertTrue(robot.getOrientation().equals(expectedOrientation));
104
+ assertEquals(robot.getOrientation(), expectedOrientation);
105
105
  }
106
106
 
107
107
  @Ignore("Remove to run test")
@@ -113,7 +113,7 @@ public class RobotTest {
113
113
 
114
114
  final Orientation expectedOrientation = Orientation.SOUTH;
115
115
 
116
- assertTrue(robot.getOrientation().equals(expectedOrientation));
116
+ assertEquals(robot.getOrientation(), expectedOrientation);
117
117
  }
118
118
 
119
119
  @Ignore("Remove to run test")
@@ -125,7 +125,7 @@ public class RobotTest {
125
125
 
126
126
  final Orientation expectedOrientation = Orientation.EAST;
127
127
 
128
- assertTrue(robot.getOrientation().equals(expectedOrientation));
128
+ assertEquals(robot.getOrientation(), expectedOrientation);
129
129
  }
130
130
 
131
131
  @Ignore("Remove to run test")
@@ -137,7 +137,7 @@ public class RobotTest {
137
137
 
138
138
  final Orientation expectedOrientation = Orientation.NORTH;
139
139
 
140
- assertTrue(robot.getOrientation().equals(expectedOrientation));
140
+ assertEquals(robot.getOrientation(), expectedOrientation);
141
141
  }
142
142
 
143
143
  @Ignore("Remove to run test")
@@ -148,7 +148,7 @@ public class RobotTest {
148
148
 
149
149
  robot.advance();
150
150
 
151
- assertTrue(robot.getOrientation().equals(initialOrientation));
151
+ assertEquals(robot.getOrientation(), initialOrientation);
152
152
  }
153
153
 
154
154
  @Ignore("Remove to run test")
@@ -160,7 +160,7 @@ public class RobotTest {
160
160
 
161
161
  final GridPosition expectedGridPosition = new GridPosition(0, 1);
162
162
 
163
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
163
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
164
164
  }
165
165
 
166
166
  @Ignore("Remove to run test")
@@ -172,7 +172,7 @@ public class RobotTest {
172
172
 
173
173
  final GridPosition expectedGridPosition = new GridPosition(0, -1);
174
174
 
175
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
175
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
176
176
  }
177
177
 
178
178
  @Ignore("Remove to run test")
@@ -184,7 +184,7 @@ public class RobotTest {
184
184
 
185
185
  final GridPosition expectedGridPosition = new GridPosition(1, 0);
186
186
 
187
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
187
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
188
188
  }
189
189
 
190
190
  @Ignore("Remove to run test")
@@ -196,7 +196,7 @@ public class RobotTest {
196
196
 
197
197
  final GridPosition expectedGridPosition = new GridPosition(-1, 0);
198
198
 
199
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
199
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
200
200
  }
201
201
 
202
202
  @Ignore("Remove to run test")
@@ -209,8 +209,8 @@ public class RobotTest {
209
209
  final GridPosition expectedGridPosition = new GridPosition(-4, 1);
210
210
  final Orientation expectedOrientation = Orientation.WEST;
211
211
 
212
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
213
- assertTrue(robot.getOrientation().equals(expectedOrientation));
212
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
213
+ assertEquals(robot.getOrientation(), expectedOrientation);
214
214
  }
215
215
 
216
216
  @Ignore("Remove to run test")
@@ -223,8 +223,8 @@ public class RobotTest {
223
223
  final GridPosition expectedGridPosition = new GridPosition(-3, -8);
224
224
  final Orientation expectedOrientation = Orientation.SOUTH;
225
225
 
226
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
227
- assertTrue(robot.getOrientation().equals(expectedOrientation));
226
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
227
+ assertEquals(robot.getOrientation(), expectedOrientation);
228
228
  }
229
229
 
230
230
  @Ignore("Remove to run test")
@@ -237,8 +237,8 @@ public class RobotTest {
237
237
  final GridPosition expectedGridPosition = new GridPosition(11, 5);
238
238
  final Orientation expectedOrientation = Orientation.NORTH;
239
239
 
240
- assertTrue(robot.getGridPosition().equals(expectedGridPosition));
241
- assertTrue(robot.getOrientation().equals(expectedOrientation));
240
+ assertEquals(robot.getGridPosition(), expectedGridPosition);
241
+ assertEquals(robot.getOrientation(), expectedOrientation);
242
242
  }
243
243
 
244
244
  }
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var HelloWorld = function() {};
4
+
5
+ HelloWorld.prototype.hello = function(name) {
6
+ name = name || 'World';
7
+ return 'Hello, ' + name + '!';
8
+ };
9
+
10
+ module.exports = HelloWorld;
@@ -0,0 +1,3 @@
1
+ fun getGreeting(): String {
2
+ return "Hello, World!"
3
+ }
@@ -0,0 +1,35 @@
1
+ class ChangeCalculator(coins: List<Int>) {
2
+
3
+ private val sortedCoins = coins.sorted()
4
+
5
+ fun computeMostEfficientChange(grandTotal: Int): List<Int> {
6
+ require(grandTotal >= 0) { "Negative totals are not allowed." }
7
+
8
+ val minimalCoinsMap = mutableMapOf<Int, List<Int>?>()
9
+ minimalCoinsMap.put(0, ArrayList())
10
+
11
+ for (total in 1..grandTotal) {
12
+ val minimalCoins = sortedCoins
13
+ .filter { it <= total }
14
+ .mapNotNull { coin ->
15
+ val minimalRemainderCoins = minimalCoinsMap[total - coin]
16
+ if (minimalRemainderCoins != null) prepend(coin, minimalRemainderCoins) else null
17
+ }
18
+ .sortedBy { it.size }
19
+ .firstOrNull()
20
+
21
+ minimalCoinsMap.put(total, minimalCoins)
22
+ }
23
+
24
+ return minimalCoinsMap[grandTotal] ?: throw IllegalArgumentException(
25
+ "The total $grandTotal cannot be represented in the given currency.")
26
+ }
27
+
28
+ private fun prepend(integer: Int, integers: List<Int>): List<Int> {
29
+ val result = mutableListOf<Int>()
30
+ result.add(integer)
31
+ result.addAll(integers)
32
+ return result
33
+ }
34
+
35
+ }
@@ -0,0 +1,105 @@
1
+ import org.assertj.core.api.Assertions.assertThat
2
+ import org.junit.Ignore
3
+ import org.junit.Rule
4
+ import org.junit.Test
5
+ import org.junit.rules.ExpectedException
6
+
7
+ /*
8
+ * version: 1.1.0
9
+ */
10
+ class ChangeCalculatorTest {
11
+
12
+ @Rule
13
+ @JvmField
14
+ var expectedException: ExpectedException = ExpectedException.none()
15
+
16
+ @Test
17
+ fun singleCoinChange() {
18
+ val computedChange = ChangeCalculator(listOf(1, 5, 10, 25, 100)).computeMostEfficientChange(25)
19
+ assertThat(computedChange).containsExactly(25)
20
+ }
21
+
22
+ @Ignore
23
+ @Test
24
+ fun multipleCoinChange() {
25
+ val computedChange = ChangeCalculator(listOf(1, 5, 10, 25, 100)).computeMostEfficientChange(15)
26
+ assertThat(computedChange).containsExactly(5, 10)
27
+ }
28
+
29
+ @Ignore
30
+ @Test
31
+ fun changeWithLilliputianCoins() {
32
+ val computedChange = ChangeCalculator(listOf(1, 4, 15, 20, 50)).computeMostEfficientChange(23)
33
+ assertThat(computedChange).containsExactly(4, 4, 15)
34
+ }
35
+
36
+ @Ignore
37
+ @Test
38
+ fun changeWithLowerElboniaCoins() {
39
+ val computedChange = ChangeCalculator(listOf(1, 5, 10, 21, 25)).computeMostEfficientChange(63)
40
+ assertThat(computedChange).containsExactly(21, 21, 21)
41
+ }
42
+
43
+ @Ignore
44
+ @Test
45
+ fun largeTargetValues() {
46
+ val computedChange = ChangeCalculator(listOf(1, 2, 5, 10, 20, 50, 100)).computeMostEfficientChange(999)
47
+ assertThat(computedChange)
48
+ .containsExactly(2, 2, 5, 20, 20, 50, 100, 100, 100, 100, 100, 100, 100, 100, 100)
49
+ }
50
+
51
+ @Ignore
52
+ @Test
53
+ fun possibleChangeWithoutUnitCoinsAvailable() {
54
+ val computedChange = ChangeCalculator(listOf(2, 5, 10, 20, 50)).computeMostEfficientChange(21)
55
+ assertThat(computedChange).containsExactly(2, 2, 2, 5, 10)
56
+ }
57
+
58
+ @Ignore
59
+ @Test
60
+ fun anotherPossibleChangeWithoutUnitCoinsAvailable() {
61
+ val computedChange = ChangeCalculator(listOf(4, 5)).computeMostEfficientChange(27)
62
+ assertThat(computedChange).containsExactly(4, 4, 4, 5, 5, 5)
63
+ }
64
+
65
+ @Ignore
66
+ @Test
67
+ fun noCoinsMake0Change() {
68
+ val computedChange = ChangeCalculator(listOf(1, 5, 10, 21, 25)).computeMostEfficientChange(0)
69
+ assertThat(computedChange).isEmpty()
70
+ }
71
+
72
+ @Ignore
73
+ @Test
74
+ fun errorTestingForChangeSmallerThanTheSmallestCoin() {
75
+ val changeCalculator = ChangeCalculator(listOf(5, 10))
76
+
77
+ expectedException.expect(IllegalArgumentException::class.java)
78
+ expectedException.expectMessage("The total 3 cannot be represented in the given currency.")
79
+
80
+ changeCalculator.computeMostEfficientChange(3)
81
+ }
82
+
83
+ @Ignore
84
+ @Test
85
+ fun errorIfNoCombinationCanAddUpToTarget() {
86
+ val changeCalculator = ChangeCalculator(listOf(5, 10))
87
+
88
+ expectedException.expect(IllegalArgumentException::class.java)
89
+ expectedException.expectMessage("The total 94 cannot be represented in the given currency.")
90
+
91
+ changeCalculator.computeMostEfficientChange(94)
92
+ }
93
+
94
+ @Ignore
95
+ @Test
96
+ fun cannotFindNegativeChangeValues() {
97
+ val changeCalculator = ChangeCalculator(listOf(1, 2, 5))
98
+
99
+ expectedException.expect(IllegalArgumentException::class.java)
100
+ expectedException.expectMessage("Negative totals are not allowed.")
101
+
102
+ changeCalculator.computeMostEfficientChange(-5)
103
+ }
104
+
105
+ }