trackler 2.2.1.52 → 2.2.1.53
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 +4 -4
- data/lib/trackler/version.rb +1 -1
- data/problem-specifications/exercises/leap/canonical-data.json +2 -2
- data/tracks/cfml/tasks/FormatConfig.cfc +6 -4
- data/tracks/cfml/tasks/GenerateReadme.cfc +197 -0
- data/tracks/cfml/tasks/ScaffoldExercise.cfc +6 -0
- data/tracks/csharp/config.json +1 -1
- data/tracks/delphi/exercises/leap/uLeapTests.pas +1 -1
- data/tracks/fsharp/exercises/clock/Clock.fs +1 -1
- data/tracks/fsharp/exercises/clock/ClockTest.fs +239 -61
- data/tracks/fsharp/exercises/clock/Example.fs +3 -3
- data/tracks/fsharp/exercises/dominoes/DominoesTest.fs +29 -26
- data/tracks/fsharp/exercises/largest-series-product/LargestSeriesProductTest.fs +30 -15
- data/tracks/fsharp/exercises/leap/LeapTest.fs +2 -2
- data/tracks/fsharp/exercises/rectangles/Example.fs +1 -1
- data/tracks/fsharp/exercises/rectangles/Rectangles.fs +1 -1
- data/tracks/fsharp/exercises/rectangles/RectanglesTest.fs +66 -43
- data/tracks/fsharp/generators/Generators.fs +85 -1
- data/tracks/java/scripts/canonical_data_check.sh +8 -0
- data/tracks/kotlin/.gitignore +1 -0
- data/tracks/kotlin/exercises/acronym/.meta/version +1 -0
- data/tracks/kotlin/exercises/acronym/src/test/kotlin/AcronymTest.kt +9 -10
- data/tracks/kotlin/exercises/all-your-base/.meta/version +1 -1
- data/tracks/kotlin/exercises/all-your-base/src/test/kotlin/BaseConverterTest.kt +20 -20
- data/tracks/kotlin/exercises/allergies/.meta/version +1 -0
- data/tracks/kotlin/exercises/allergies/src/test/kotlin/AllergiesTest.kt +19 -72
- data/tracks/kotlin/exercises/anagram/.meta/src/reference/kotlin/Anagram.kt +7 -4
- data/tracks/kotlin/exercises/anagram/.meta/version +1 -0
- data/tracks/kotlin/exercises/anagram/src/test/kotlin/AnagramTest.kt +76 -29
- data/tracks/kotlin/exercises/atbash-cipher/.meta/version +1 -0
- data/tracks/kotlin/exercises/atbash-cipher/src/test/kotlin/AtbashTest.kt +6 -3
- data/tracks/kotlin/exercises/beer-song/.meta/version +1 -0
- data/tracks/kotlin/exercises/beer-song/src/test/kotlin/BeerSongTest.kt +21 -46
- data/tracks/kotlin/exercises/binary-search/.meta/version +1 -0
- data/tracks/kotlin/exercises/binary-search/src/test/kotlin/BinarySearchTest.kt +30 -19
- data/tracks/kotlin/exercises/bob/.meta/src/reference/kotlin/Bob.kt +8 -7
- data/tracks/kotlin/exercises/bob/.meta/version +1 -0
- data/tracks/kotlin/exercises/bob/src/test/kotlin/BobTest.kt +57 -15
- data/tracks/kotlin/exercises/bracket-push/.meta/version +1 -0
- data/tracks/kotlin/exercises/bracket-push/src/test/kotlin/BracketPushTest.kt +3 -1
- data/tracks/kotlin/exercises/collatz-conjecture/.meta/version +1 -1
- data/tracks/kotlin/exercises/difference-of-squares/.meta/version +1 -0
- data/tracks/kotlin/exercises/difference-of-squares/src/test/kotlin/SquaresTest.kt +10 -23
- data/tracks/kotlin/exercises/etl/.meta/src/reference/kotlin/ETL.kt +7 -1
- data/tracks/kotlin/exercises/etl/.meta/version +1 -0
- data/tracks/kotlin/exercises/etl/src/test/kotlin/ETLTest.kt +10 -10
- data/tracks/kotlin/exercises/flatten-array/.meta/version +1 -0
- data/tracks/kotlin/exercises/flatten-array/src/test/kotlin/FlattenerTest.kt +8 -16
- data/tracks/kotlin/exercises/gigasecond/.meta/version +1 -0
- data/tracks/kotlin/exercises/gigasecond/src/test/kotlin/GigasecondTest.kt +1 -1
- data/tracks/kotlin/exercises/hamming/.meta/src/reference/kotlin/Hamming.kt +1 -1
- data/tracks/kotlin/exercises/hamming/.meta/version +1 -1
- data/tracks/kotlin/exercises/hamming/src/test/kotlin/HammingTest.kt +4 -4
- data/tracks/kotlin/exercises/hello-world/.meta/version +1 -0
- data/tracks/kotlin/exercises/hello-world/src/test/kotlin/HelloWorldTest.kt +1 -1
- data/tracks/kotlin/exercises/isogram/.meta/version +1 -0
- data/tracks/kotlin/exercises/isogram/src/test/kotlin/IsogramTest.kt +5 -8
- data/tracks/kotlin/exercises/largest-series-product/.meta/src/reference/kotlin/Series.kt +2 -3
- data/tracks/kotlin/exercises/largest-series-product/.meta/version +1 -0
- data/tracks/kotlin/exercises/largest-series-product/src/test/kotlin/SeriesTest.kt +97 -0
- data/tracks/kotlin/exercises/leap/.meta/version +1 -0
- data/tracks/kotlin/exercises/leap/src/test/kotlin/LeapTest.kt +8 -26
- data/tracks/kotlin/exercises/list-ops/.meta/version +1 -1
- data/tracks/kotlin/exercises/luhn/.meta/version +1 -0
- data/tracks/kotlin/exercises/luhn/src/test/kotlin/LuhnTest.kt +0 -3
- data/tracks/kotlin/exercises/nth-prime/.meta/version +1 -0
- data/tracks/kotlin/exercises/nth-prime/src/test/kotlin/PrimeTest.kt +0 -2
- data/tracks/kotlin/exercises/nucleotide-count/.meta/src/reference/kotlin/{DNA.kt → Dna.kt} +3 -8
- data/tracks/kotlin/exercises/nucleotide-count/.meta/version +1 -0
- data/tracks/kotlin/exercises/nucleotide-count/src/test/kotlin/DnaTest.kt +48 -0
- data/tracks/kotlin/exercises/pangram/.meta/src/reference/kotlin/{Pangrams.kt → Pangram.kt} +1 -1
- data/tracks/kotlin/exercises/pangram/.meta/version +1 -1
- data/tracks/kotlin/exercises/pangram/src/test/kotlin/PangramTest.kt +15 -9
- data/tracks/kotlin/exercises/pascals-triangle/.meta/version +1 -0
- data/tracks/kotlin/exercises/pascals-triangle/src/test/kotlin/PascalsTriangleTest.kt +32 -14
- data/tracks/kotlin/exercises/perfect-numbers/.meta/src/reference/kotlin/NaturalNumber.kt +1 -1
- data/tracks/kotlin/exercises/perfect-numbers/.meta/version +1 -0
- data/tracks/kotlin/exercises/perfect-numbers/src/test/kotlin/{PerfectNumbersTest.kt → NaturalNumberTest.kt} +25 -7
- data/tracks/kotlin/exercises/phone-number/.meta/src/reference/kotlin/PhoneNumber.kt +15 -7
- data/tracks/kotlin/exercises/phone-number/.meta/version +1 -0
- data/tracks/kotlin/exercises/phone-number/src/test/kotlin/PhoneNumberTest.kt +46 -29
- data/tracks/kotlin/exercises/pig-latin/.meta/src/reference/kotlin/PigLatin.kt +2 -2
- data/tracks/kotlin/exercises/pig-latin/.meta/version +1 -0
- data/tracks/kotlin/exercises/pig-latin/src/test/kotlin/PigLatinTest.kt +21 -10
- data/tracks/kotlin/exercises/raindrops/.meta/version +1 -0
- data/tracks/kotlin/exercises/raindrops/src/test/kotlin/RaindropsTest.kt +19 -26
- data/tracks/kotlin/exercises/react/.meta/version +1 -0
- data/tracks/kotlin/exercises/react/src/test/kotlin/ReactTest.kt +11 -4
- data/tracks/kotlin/exercises/robot-simulator/.meta/version +1 -1
- data/tracks/kotlin/exercises/roman-numerals/.meta/version +1 -0
- data/tracks/kotlin/exercises/roman-numerals/src/test/kotlin/RomanNumeralTest.kt +1 -2
- data/tracks/kotlin/exercises/rotational-cipher/.meta/version +1 -1
- data/tracks/kotlin/exercises/rotational-cipher/src/test/kotlin/RotationalCipherTest.kt +7 -7
- data/tracks/kotlin/exercises/scrabble-score/.meta/src/reference/kotlin/{Scrabble.kt → ScrabbleScore.kt} +1 -1
- data/tracks/kotlin/exercises/scrabble-score/.meta/version +1 -0
- data/tracks/kotlin/exercises/scrabble-score/src/test/kotlin/ScrabbleScoreTest.kt +9 -7
- data/tracks/kotlin/exercises/sieve/.meta/version +1 -0
- data/tracks/kotlin/exercises/sieve/src/test/kotlin/SieveTest.kt +8 -0
- data/tracks/kotlin/exercises/space-age/.meta/version +1 -0
- data/tracks/kotlin/exercises/space-age/src/test/kotlin/SpaceAgeTest.kt +1 -16
- data/tracks/kotlin/exercises/sum-of-multiples/.meta/version +1 -0
- data/tracks/kotlin/exercises/sum-of-multiples/src/test/kotlin/SumOfMultiplesTest.kt +7 -7
- data/tracks/kotlin/exercises/triangle/.meta/version +1 -0
- data/tracks/kotlin/exercises/two-fer/.meta/version +1 -0
- data/tracks/kotlin/exercises/two-fer/src/test/kotlin/TwoferTest.kt +0 -1
- data/tracks/kotlin/exercises/word-count/.meta/src/reference/kotlin/WordCount.kt +6 -2
- data/tracks/kotlin/exercises/word-count/.meta/version +1 -0
- data/tracks/kotlin/exercises/word-count/src/test/kotlin/WordCountTest.kt +31 -9
- data/tracks/kotlin/scripts/canonical_data_check.sh +8 -0
- data/tracks/perl6/exercises/leap/leap.t +2 -2
- data/tracks/php/config.json +16 -0
- data/tracks/php/exercises/crypto-square/crypto-square_test.php +50 -0
- data/tracks/php/exercises/crypto-square/example.php +32 -0
- data/tracks/php/exercises/meetup/README.md +21 -0
- data/tracks/php/exercises/meetup/example.php +19 -0
- data/tracks/php/exercises/meetup/meetup_test.php +577 -0
- data/tracks/python/README.md +7 -5
- data/tracks/python/config.json +36 -27
- data/tracks/python/docs/TESTS.md +36 -12
- data/tracks/python/exercises/complex-numbers/complex_numbers_test.py +1 -1
- data/tracks/python/exercises/diffie-hellman/.meta/hints.md +16 -0
- data/tracks/python/exercises/diffie-hellman/README.md +15 -2
- data/tracks/python/exercises/error-handling/README.md +23 -0
- data/tracks/python/exercises/error-handling/error_handling.py +14 -0
- data/tracks/python/exercises/error-handling/error_handling_test.py +66 -0
- data/tracks/python/exercises/error-handling/example.py +21 -0
- data/tracks/python/exercises/forth/forth_test.py +1 -1
- data/tracks/python/exercises/isogram/isogram_test.py +5 -3
- data/tracks/python/exercises/leap/leap_test.py +2 -2
- data/tracks/python/exercises/rotational-cipher/rotational_cipher_test.py +4 -4
- data/tracks/python/exercises/simple-cipher/.meta/hints.md +16 -0
- data/tracks/python/exercises/simple-cipher/README.md +17 -0
- data/tracks/python/exercises/sum-of-multiples/sum_of_multiples_test.py +4 -1
- data/tracks/python/exercises/twelve-days/example.py +3 -3
- data/tracks/python/exercises/twelve-days/twelve_days.py +2 -2
- metadata +53 -9
- data/tracks/kotlin/exercises/largest-series-product/src/test/kotlin/SeriesInvalidInputTest.kt +0 -30
- data/tracks/kotlin/exercises/largest-series-product/src/test/kotlin/SeriesValidInputTest.kt +0 -34
- data/tracks/kotlin/exercises/nucleotide-count/src/test/kotlin/NucleotideTest.kt +0 -87
|
@@ -15,10 +15,10 @@ object PigLatin {
|
|
|
15
15
|
return word
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
private val consonant = Regex("^([^aeiou]?qu|[^aeiou]+)([a-z]*)", RegexOption.IGNORE_CASE)
|
|
18
|
+
private val consonant = Regex("^([^aeiou]?qu|[^aeiouy]+|[^aeiou]+)([a-z]*)", RegexOption.IGNORE_CASE)
|
|
19
19
|
private fun splitInitialConsonantSound(word: String) = consonant.matchEntire(word)?.groupValues?.drop(1)
|
|
20
20
|
|
|
21
21
|
private val vowels = Regex("^([aeiou]|y[^aeiou]|xr)[a-z]*", RegexOption.IGNORE_CASE)
|
|
22
22
|
private fun startsWithVowelSound(word: String) = vowels.matches(word)
|
|
23
23
|
|
|
24
|
-
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.0
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import org.junit.Test
|
|
2
|
-
import org.junit.Ignore
|
|
3
2
|
import org.junit.runner.RunWith
|
|
4
3
|
import org.junit.runners.Parameterized
|
|
5
4
|
import kotlin.test.assertEquals
|
|
@@ -12,17 +11,20 @@ class PigLatinTest(val input: String, val expectedOutput: String) {
|
|
|
12
11
|
@Parameterized.Parameters(name = "{index}: translate({0})={1}")
|
|
13
12
|
fun data() = arrayOf(
|
|
14
13
|
// Ay is added to words that start with vowels
|
|
15
|
-
arrayOf("apple",
|
|
16
|
-
arrayOf("ear",
|
|
17
|
-
arrayOf("igloo",
|
|
14
|
+
arrayOf("apple", "appleay"),
|
|
15
|
+
arrayOf("ear", "earay"),
|
|
16
|
+
arrayOf("igloo", "iglooay"),
|
|
18
17
|
arrayOf("object", "objectay"),
|
|
19
|
-
arrayOf("under",
|
|
18
|
+
arrayOf("under", "underay"),
|
|
19
|
+
|
|
20
|
+
// Ay is added to words that start with vowels followed by qu
|
|
21
|
+
arrayOf("equal", "equalay"),
|
|
20
22
|
|
|
21
23
|
// First letter and ay are moved to the end of words that start with consonants
|
|
22
|
-
arrayOf("pig",
|
|
23
|
-
arrayOf("koala",
|
|
24
|
-
arrayOf("
|
|
25
|
-
arrayOf("
|
|
24
|
+
arrayOf("pig", "igpay"),
|
|
25
|
+
arrayOf("koala", "oalakay"),
|
|
26
|
+
arrayOf("xenon", "enonxay"),
|
|
27
|
+
arrayOf("qat", "atqay"),
|
|
26
28
|
|
|
27
29
|
// Ch is treated like a single consonant
|
|
28
30
|
arrayOf("chair", "airchay"),
|
|
@@ -48,14 +50,23 @@ class PigLatinTest(val input: String, val expectedOutput: String) {
|
|
|
48
50
|
// Xr is treated like a single vowel
|
|
49
51
|
arrayOf("xray", "xrayay"),
|
|
50
52
|
|
|
53
|
+
// Y is treated like a consonant at the beginning of a word
|
|
54
|
+
arrayOf("yellow", "ellowyay"),
|
|
55
|
+
|
|
56
|
+
// Y is treated like a vowel at the end of a consonant cluster
|
|
57
|
+
arrayOf("rhythm", "ythmrhay"),
|
|
58
|
+
|
|
59
|
+
// Y as second letter in two letter word
|
|
60
|
+
arrayOf("my", "ymay"),
|
|
61
|
+
|
|
51
62
|
// Phrases are translated
|
|
52
63
|
arrayOf("quick fast run", "ickquay astfay unray")
|
|
53
64
|
)
|
|
54
65
|
}
|
|
55
66
|
|
|
56
|
-
|
|
57
67
|
@Test
|
|
58
68
|
fun test() {
|
|
59
69
|
assertEquals(expectedOutput, PigLatin.translate(input))
|
|
60
70
|
}
|
|
71
|
+
|
|
61
72
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -11,37 +11,30 @@ class RaindropsTest(val input: Int, val expectedOutput: String) {
|
|
|
11
11
|
@JvmStatic
|
|
12
12
|
@Parameterized.Parameters(name = "{index}: raindrops({0})={1}")
|
|
13
13
|
fun data() = listOf(
|
|
14
|
-
|
|
15
|
-
arrayOf(
|
|
16
|
-
arrayOf(
|
|
17
|
-
arrayOf(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
arrayOf(
|
|
21
|
-
arrayOf(
|
|
22
|
-
arrayOf(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
arrayOf(
|
|
26
|
-
arrayOf(
|
|
27
|
-
arrayOf(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
arrayOf(
|
|
31
|
-
arrayOf(
|
|
32
|
-
arrayOf(49, "Plong"),
|
|
33
|
-
|
|
34
|
-
// Numbers with multiple activating prime factors
|
|
35
|
-
arrayOf(15, "PlingPlang"),
|
|
36
|
-
arrayOf(21, "PlingPlong"),
|
|
37
|
-
arrayOf(35, "PlangPlong"),
|
|
38
|
-
arrayOf(105, "PlingPlangPlong")
|
|
14
|
+
arrayOf( 1, "1"),
|
|
15
|
+
arrayOf( 3, "Pling"),
|
|
16
|
+
arrayOf( 5, "Plang"),
|
|
17
|
+
arrayOf( 7, "Plong"),
|
|
18
|
+
arrayOf( 6, "Pling"),
|
|
19
|
+
arrayOf( 8, "8"),
|
|
20
|
+
arrayOf( 9, "Pling"),
|
|
21
|
+
arrayOf( 10, "Plang"),
|
|
22
|
+
arrayOf( 14, "Plong"),
|
|
23
|
+
arrayOf( 15, "PlingPlang"),
|
|
24
|
+
arrayOf( 21, "PlingPlong"),
|
|
25
|
+
arrayOf( 25, "Plang"),
|
|
26
|
+
arrayOf( 27, "Pling"),
|
|
27
|
+
arrayOf( 35, "PlangPlong"),
|
|
28
|
+
arrayOf( 49, "Plong"),
|
|
29
|
+
arrayOf( 52, "52"),
|
|
30
|
+
arrayOf( 105, "PlingPlangPlong"),
|
|
31
|
+
arrayOf(3125, "Plang")
|
|
39
32
|
)
|
|
40
33
|
}
|
|
41
34
|
|
|
42
|
-
|
|
43
35
|
@Test
|
|
44
36
|
fun test() {
|
|
45
37
|
assertEquals(expectedOutput, Raindrops.convert(input))
|
|
46
38
|
}
|
|
39
|
+
|
|
47
40
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -5,6 +5,7 @@ import org.junit.runners.Parameterized
|
|
|
5
5
|
import kotlin.test.assertEquals
|
|
6
6
|
|
|
7
7
|
class ReactTest {
|
|
8
|
+
|
|
8
9
|
@Test
|
|
9
10
|
fun inputCellsHaveValue() {
|
|
10
11
|
val reactor = Reactor<Int>()
|
|
@@ -132,7 +133,7 @@ class ReactTest {
|
|
|
132
133
|
val vals2 = mutableListOf<Int>()
|
|
133
134
|
output.addCallback { vals2.add(it) }
|
|
134
135
|
|
|
135
|
-
for (i in 1..
|
|
136
|
+
for (i in 1..3) {
|
|
136
137
|
sub1.cancel()
|
|
137
138
|
}
|
|
138
139
|
|
|
@@ -170,17 +171,22 @@ class ReactTest {
|
|
|
170
171
|
val vals = mutableListOf<Int>()
|
|
171
172
|
alwaysTwo.addCallback { vals.add(it) }
|
|
172
173
|
|
|
173
|
-
for (i in
|
|
174
|
+
for (i in 2..5) {
|
|
174
175
|
input.value = i
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
assertEquals(listOf<Int>(), vals)
|
|
178
179
|
}
|
|
180
|
+
|
|
179
181
|
}
|
|
180
182
|
|
|
183
|
+
/*
|
|
184
|
+
* Extension
|
|
185
|
+
*
|
|
186
|
+
* This is a digital logic circuit called an adder:
|
|
187
|
+
* https://en.wikipedia.org/wiki/Adder_(electronics)
|
|
188
|
+
*/
|
|
181
189
|
@RunWith(Parameterized::class)
|
|
182
|
-
// This is a digital logic circuit called an adder:
|
|
183
|
-
// https://en.wikipedia.org/wiki/Adder_(electronics)
|
|
184
190
|
class ReactAdderTest(val input: Input, val expected: Expected) {
|
|
185
191
|
|
|
186
192
|
companion object {
|
|
@@ -218,4 +224,5 @@ class ReactAdderTest(val input: Input, val expected: Expected) {
|
|
|
218
224
|
|
|
219
225
|
assertEquals(expected, Expected(sum=sum.value, carryOut=carryOut.value))
|
|
220
226
|
}
|
|
227
|
+
|
|
221
228
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -12,7 +12,6 @@ class RomanNumeralsTest(val input: Int, val expectedOutput: String) {
|
|
|
12
12
|
@JvmStatic
|
|
13
13
|
@Parameterized.Parameters(name = "{index}: romanNumeral({0})={1}")
|
|
14
14
|
fun data() = listOf(
|
|
15
|
-
arrayOf(0, ""),
|
|
16
15
|
arrayOf(1, "I"),
|
|
17
16
|
arrayOf(2, "II"),
|
|
18
17
|
arrayOf(3, "III"),
|
|
@@ -34,9 +33,9 @@ class RomanNumeralsTest(val input: Int, val expectedOutput: String) {
|
|
|
34
33
|
)
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
|
|
38
36
|
@Test
|
|
39
37
|
fun test() {
|
|
40
38
|
assertEquals(expectedOutput, RomanNumeral.value(input))
|
|
41
39
|
}
|
|
40
|
+
|
|
42
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
1.
|
|
1
|
+
1.1.0
|
|
@@ -4,6 +4,13 @@ import kotlin.test.assertEquals
|
|
|
4
4
|
|
|
5
5
|
class RotationalCipherTest {
|
|
6
6
|
|
|
7
|
+
@Test
|
|
8
|
+
fun testRotateLowercaseABy0() {
|
|
9
|
+
val cipher = RotationalCipher(0)
|
|
10
|
+
assertEquals("a", cipher.encode("a"))
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@Ignore
|
|
7
14
|
@Test
|
|
8
15
|
fun testRotateLowercaseABy1NoWrapAround() {
|
|
9
16
|
val cipher = RotationalCipher(1)
|
|
@@ -17,13 +24,6 @@ class RotationalCipherTest {
|
|
|
17
24
|
assertEquals("a", cipher.encode("a"))
|
|
18
25
|
}
|
|
19
26
|
|
|
20
|
-
@Ignore
|
|
21
|
-
@Test
|
|
22
|
-
fun testRotateLowercaseABy0() {
|
|
23
|
-
val cipher = RotationalCipher(0)
|
|
24
|
-
assertEquals("a", cipher.encode("a"))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
27
|
@Ignore
|
|
28
28
|
@Test
|
|
29
29
|
fun testRotateLowercaseMBy13NoWrapAround() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
object
|
|
1
|
+
object ScrabbleScore {
|
|
2
2
|
private val scoreToLetters = mapOf(1 to "AEIOULNRST", 2 to "DG", 3 to "BCMP", 4 to "FHVWY", 5 to "K", 8 to "JX", 10 to "QZ").mapValues { it.value.toCharArray() }
|
|
3
3
|
private val letterToScore = scoreToLetters.flatMap { entry -> entry.value.map { char -> Pair(char, entry.key) } }.toMap()
|
|
4
4
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import org.junit.Test
|
|
2
|
-
import org.junit.Ignore
|
|
3
2
|
import org.junit.runner.RunWith
|
|
4
3
|
import org.junit.runners.Parameterized
|
|
5
4
|
import kotlin.test.assertEquals
|
|
@@ -11,20 +10,23 @@ class ScrabbleScoreTest(val input: String, val expectedOutput: Int) {
|
|
|
11
10
|
@JvmStatic
|
|
12
11
|
@Parameterized.Parameters(name = "{index}: scoreWord({0})={1}")
|
|
13
12
|
fun data() = listOf(
|
|
14
|
-
arrayOf("", 0),
|
|
15
|
-
arrayOf(" \t\n", 0),
|
|
16
13
|
arrayOf("a", 1),
|
|
14
|
+
arrayOf("A", 1),
|
|
17
15
|
arrayOf("f", 4),
|
|
16
|
+
arrayOf("at", 2),
|
|
17
|
+
arrayOf("zoo", 12),
|
|
18
18
|
arrayOf("street", 6),
|
|
19
19
|
arrayOf("quirky", 22),
|
|
20
|
-
arrayOf("
|
|
21
|
-
arrayOf("
|
|
20
|
+
arrayOf("OxyphenButazone", 41),
|
|
21
|
+
arrayOf("pinata", 8),
|
|
22
|
+
arrayOf("", 0),
|
|
23
|
+
arrayOf("abcdefghijklmnopqrstuvwxyz", 87)
|
|
22
24
|
)
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
|
|
26
27
|
@Test
|
|
27
28
|
fun test() {
|
|
28
|
-
assertEquals(expectedOutput,
|
|
29
|
+
assertEquals(expectedOutput, ScrabbleScore.scoreWord(input))
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -4,7 +4,14 @@ import kotlin.test.assertEquals
|
|
|
4
4
|
|
|
5
5
|
class SieveTest {
|
|
6
6
|
|
|
7
|
+
@Test
|
|
8
|
+
fun noPrimesUnder2() {
|
|
9
|
+
val expectedOutput = emptyList<Int>()
|
|
10
|
+
|
|
11
|
+
assertEquals(expectedOutput, Sieve.primesUpTo(1))
|
|
12
|
+
}
|
|
7
13
|
|
|
14
|
+
@Ignore
|
|
8
15
|
@Test
|
|
9
16
|
fun findFirstPrime() {
|
|
10
17
|
val expectedOutput = listOf(2)
|
|
@@ -35,4 +42,5 @@ class SieveTest {
|
|
|
35
42
|
|
|
36
43
|
assertEquals(expectedOutput, Sieve.primesUpTo(1000))
|
|
37
44
|
}
|
|
45
|
+
|
|
38
46
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -4,15 +4,6 @@ import kotlin.test.assertEquals
|
|
|
4
4
|
|
|
5
5
|
class SpaceAgeTest {
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
@Test
|
|
9
|
-
fun ageInSeconds() {
|
|
10
|
-
val age = SpaceAge(1000000)
|
|
11
|
-
|
|
12
|
-
assertEquals(1000000, age.seconds)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
@Ignore
|
|
16
7
|
@Test
|
|
17
8
|
fun ageOnEarth() {
|
|
18
9
|
val age = SpaceAge(1000000000)
|
|
@@ -25,7 +16,6 @@ class SpaceAgeTest {
|
|
|
25
16
|
fun ageOnMercury() {
|
|
26
17
|
val age = SpaceAge(2134835688)
|
|
27
18
|
|
|
28
|
-
assertEquals(67.65, age.onEarth())
|
|
29
19
|
assertEquals(280.88, age.onMercury())
|
|
30
20
|
}
|
|
31
21
|
|
|
@@ -34,7 +24,6 @@ class SpaceAgeTest {
|
|
|
34
24
|
fun ageOnVenus() {
|
|
35
25
|
val age = SpaceAge(189839836)
|
|
36
26
|
|
|
37
|
-
assertEquals(6.02, age.onEarth())
|
|
38
27
|
assertEquals(9.78, age.onVenus())
|
|
39
28
|
}
|
|
40
29
|
|
|
@@ -43,7 +32,6 @@ class SpaceAgeTest {
|
|
|
43
32
|
fun ageOnMars() {
|
|
44
33
|
val age = SpaceAge(2329871239L)
|
|
45
34
|
|
|
46
|
-
assertEquals(73.83, age.onEarth())
|
|
47
35
|
assertEquals(39.25, age.onMars())
|
|
48
36
|
}
|
|
49
37
|
|
|
@@ -52,7 +40,6 @@ class SpaceAgeTest {
|
|
|
52
40
|
fun ageOnJupiter() {
|
|
53
41
|
val age = SpaceAge(901876382)
|
|
54
42
|
|
|
55
|
-
assertEquals(28.58, age.onEarth())
|
|
56
43
|
assertEquals(2.41, age.onJupiter())
|
|
57
44
|
}
|
|
58
45
|
|
|
@@ -61,7 +48,6 @@ class SpaceAgeTest {
|
|
|
61
48
|
fun ageOnSaturn() {
|
|
62
49
|
val age = SpaceAge(3000000000L)
|
|
63
50
|
|
|
64
|
-
assertEquals(95.06, age.onEarth())
|
|
65
51
|
assertEquals(3.23, age.onSaturn())
|
|
66
52
|
}
|
|
67
53
|
|
|
@@ -70,7 +56,6 @@ class SpaceAgeTest {
|
|
|
70
56
|
fun ageOnUranus() {
|
|
71
57
|
val age = SpaceAge(3210123456L)
|
|
72
58
|
|
|
73
|
-
assertEquals(101.72, age.onEarth())
|
|
74
59
|
assertEquals(1.21, age.onUranus())
|
|
75
60
|
}
|
|
76
61
|
|
|
@@ -79,7 +64,7 @@ class SpaceAgeTest {
|
|
|
79
64
|
fun ageOnNeptune() {
|
|
80
65
|
val age = SpaceAge(8210123456L)
|
|
81
66
|
|
|
82
|
-
assertEquals(260.16, age.onEarth())
|
|
83
67
|
assertEquals(1.58, age.onNeptune())
|
|
84
68
|
}
|
|
69
|
+
|
|
85
70
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.0
|
|
@@ -17,14 +17,14 @@ class SumOfMultiplesTest {
|
|
|
17
17
|
|
|
18
18
|
@Test
|
|
19
19
|
@Ignore
|
|
20
|
-
fun `multiples of 3
|
|
21
|
-
assertEquals(
|
|
20
|
+
fun `multiples of 3 up to 7`() {
|
|
21
|
+
assertEquals(9, SumOfMultiples.sum(setOf(3), 7))
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
@Test
|
|
25
25
|
@Ignore
|
|
26
|
-
fun `multiples of 3 or 5 up to
|
|
27
|
-
assertEquals(
|
|
26
|
+
fun `multiples of 3 or 5 up to 10`() {
|
|
27
|
+
assertEquals(23, SumOfMultiples.sum(setOf(3, 5), 10))
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
@Test
|
|
@@ -36,7 +36,7 @@ class SumOfMultiplesTest {
|
|
|
36
36
|
@Test
|
|
37
37
|
@Ignore
|
|
38
38
|
fun `multiples of 3 or 5 up to 1000`() {
|
|
39
|
-
assertEquals(
|
|
39
|
+
assertEquals(233168, SumOfMultiples.sum(setOf(3, 5), 1000))
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
@Test
|
|
@@ -66,7 +66,7 @@ class SumOfMultiplesTest {
|
|
|
66
66
|
@Test
|
|
67
67
|
@Ignore
|
|
68
68
|
fun `multiples of 43 or 47 up to 10000`() {
|
|
69
|
-
assertEquals(
|
|
69
|
+
assertEquals(2203160, SumOfMultiples.sum(setOf(43, 47), 10000))
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@Test
|
|
@@ -78,7 +78,7 @@ class SumOfMultiplesTest {
|
|
|
78
78
|
@Test
|
|
79
79
|
@Ignore
|
|
80
80
|
fun `multiples of an empty set up to 10000`() {
|
|
81
|
-
assertEquals(0, SumOfMultiples.sum(emptySet(),
|
|
81
|
+
assertEquals(0, SumOfMultiples.sum(emptySet(), 10000))
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.1.0
|