trackler 2.2.1.52 → 2.2.1.53
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,5 +1,11 @@
|
|
1
1
|
object ETL {
|
2
|
+
|
2
3
|
fun transform(old: Map<Int, Collection<Char>>): Map<Char, Int> {
|
3
|
-
return old.flatMap { mapEntry ->
|
4
|
+
return old.flatMap { mapEntry ->
|
5
|
+
mapEntry.value.map { word ->
|
6
|
+
Pair(word.toLowerCase(), mapEntry.key)
|
7
|
+
}
|
8
|
+
}.toMap()
|
4
9
|
}
|
10
|
+
|
5
11
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -4,10 +4,9 @@ import kotlin.test.assertEquals
|
|
4
4
|
|
5
5
|
class ETLTest {
|
6
6
|
|
7
|
-
|
8
7
|
@Test
|
9
|
-
fun
|
10
|
-
val old = mapOf(1 to listOf('
|
8
|
+
fun aSingleLetter() {
|
9
|
+
val old = mapOf(1 to listOf('A'))
|
11
10
|
val expected = mapOf('a' to 1)
|
12
11
|
|
13
12
|
assertEquals(expected, ETL.transform(old))
|
@@ -15,25 +14,25 @@ class ETLTest {
|
|
15
14
|
|
16
15
|
@Ignore
|
17
16
|
@Test
|
18
|
-
fun
|
19
|
-
val old = mapOf(1 to listOf('A', 'E', 'I'))
|
20
|
-
val expected = mapOf('a' to 1, 'e' to 1, 'i' to 1)
|
17
|
+
fun singleScoreWithMultipleLetters() {
|
18
|
+
val old = mapOf(1 to listOf('A', 'E', 'I', 'O', 'U'))
|
19
|
+
val expected = mapOf('a' to 1, 'e' to 1, 'i' to 1, 'o' to 1, 'u' to 1)
|
21
20
|
|
22
21
|
assertEquals(expected, ETL.transform(old))
|
23
22
|
}
|
24
23
|
|
25
24
|
@Ignore
|
26
25
|
@Test
|
27
|
-
fun
|
28
|
-
val old = mapOf(1 to listOf('A', 'E'
|
29
|
-
val expected = mapOf('a' to 1, '
|
26
|
+
fun multipleScoresWithMultipleLetters() {
|
27
|
+
val old = mapOf(1 to listOf('A', 'E'), 2 to listOf('D', 'G'))
|
28
|
+
val expected = mapOf('a' to 1, 'd' to 2, 'e' to 1, 'g' to 2)
|
30
29
|
|
31
30
|
assertEquals(expected, ETL.transform(old))
|
32
31
|
}
|
33
32
|
|
34
33
|
@Ignore
|
35
34
|
@Test
|
36
|
-
fun
|
35
|
+
fun multipleScoresWithDifferingNumbersOfLetters() {
|
37
36
|
val old = mapOf(
|
38
37
|
1 to listOf('A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'),
|
39
38
|
2 to listOf('D', 'G'),
|
@@ -54,4 +53,5 @@ class ETLTest {
|
|
54
53
|
|
55
54
|
assertEquals(expected, ETL.transform(old))
|
56
55
|
}
|
56
|
+
|
57
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
@@ -4,24 +4,16 @@ import kotlin.test.assertEquals
|
|
4
4
|
|
5
5
|
class FlattenerTest {
|
6
6
|
|
7
|
-
|
8
7
|
@Test
|
9
|
-
fun
|
10
|
-
val
|
11
|
-
assertEquals(
|
8
|
+
fun flatListIsUnchanged() {
|
9
|
+
val flatList = listOf(0, 1, 2)
|
10
|
+
assertEquals(listOf(0, 1, 2), Flattener.flatten(flatList))
|
12
11
|
}
|
13
12
|
|
14
13
|
@Ignore
|
15
14
|
@Test
|
16
15
|
fun flattens2LevelNestedList() {
|
17
|
-
val nestedList = listOf(1, listOf(2, 3, 4
|
18
|
-
assertEquals(listOf(1, 2, 3, 4, 5), Flattener.flatten(nestedList))
|
19
|
-
}
|
20
|
-
|
21
|
-
@Ignore
|
22
|
-
@Test
|
23
|
-
fun flattens3LevelNestedList() {
|
24
|
-
val nestedList = listOf(1, listOf(2, 3, 4), 5, listOf(6, listOf(7, 8)))
|
16
|
+
val nestedList = listOf(1, listOf(2, 3, 4, 5, 6, 7), 8)
|
25
17
|
assertEquals(listOf(1, 2, 3, 4, 5, 6, 7, 8), Flattener.flatten(nestedList))
|
26
18
|
}
|
27
19
|
|
@@ -42,15 +34,15 @@ class FlattenerTest {
|
|
42
34
|
@Ignore
|
43
35
|
@Test
|
44
36
|
fun flattens6LevelNestedListWithNulls() {
|
45
|
-
val nestedList = listOf(
|
46
|
-
assertEquals(listOf(
|
37
|
+
val nestedList = listOf(0, 2, listOf(listOf(2, 3), 8, listOf(listOf(100)), null, listOf(listOf(null))), -2)
|
38
|
+
assertEquals(listOf(0, 2, 2, 3, 8, 100, -2), Flattener.flatten(nestedList))
|
47
39
|
}
|
48
40
|
|
49
41
|
@Ignore
|
50
42
|
@Test
|
51
43
|
fun allNullNestedListReturnsEmptyList() {
|
52
|
-
val nestedList = listOf(null, listOf(
|
44
|
+
val nestedList = listOf(null, listOf(listOf(listOf(null))), null, null, listOf(listOf(null, null), null), null)
|
53
45
|
assertEquals(emptyList<Any>(), Flattener.flatten(nestedList))
|
54
46
|
}
|
55
|
-
}
|
56
47
|
|
48
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -7,7 +7,6 @@ import kotlin.test.assertEquals
|
|
7
7
|
|
8
8
|
class GigasecondTest {
|
9
9
|
|
10
|
-
|
11
10
|
@Test
|
12
11
|
fun modernTime() {
|
13
12
|
val gigaSecond = Gigasecond(LocalDate.of(2011, Month.APRIL, 25))
|
@@ -46,4 +45,5 @@ class GigasecondTest {
|
|
46
45
|
|
47
46
|
assertEquals(LocalDateTime.of(2046, Month.OCTOBER, 3, 1, 46, 39), gigaSecond.date)
|
48
47
|
}
|
48
|
+
|
49
49
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
object Hamming {
|
2
2
|
|
3
3
|
fun compute(leftStrand: String, rightStrand: String): Int {
|
4
|
-
require(leftStrand.length == rightStrand.length, {"
|
4
|
+
require(leftStrand.length == rightStrand.length, {"left and right strands must be of equal length."})
|
5
5
|
|
6
6
|
val commonPairs = leftStrand.zip(rightStrand)
|
7
7
|
return commonPairs.count { it.first != it.second }
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.1
|
@@ -60,13 +60,13 @@ class HammingTest {
|
|
60
60
|
@Ignore
|
61
61
|
@Test
|
62
62
|
fun nonUniqueCharacterInFirstStrand() {
|
63
|
-
assertEquals(1, Hamming.compute("
|
63
|
+
assertEquals(1, Hamming.compute("AAG", "AAA"))
|
64
64
|
}
|
65
65
|
|
66
66
|
@Ignore
|
67
67
|
@Test
|
68
68
|
fun nonUniqueCharacterInSecondStrand() {
|
69
|
-
assertEquals(1, Hamming.compute("
|
69
|
+
assertEquals(1, Hamming.compute("AAA", "AAG"))
|
70
70
|
}
|
71
71
|
|
72
72
|
@Ignore
|
@@ -91,7 +91,7 @@ class HammingTest {
|
|
91
91
|
@Test
|
92
92
|
fun validatesFirstStrandNotLonger() {
|
93
93
|
expectedException.expect(IllegalArgumentException::class.java)
|
94
|
-
expectedException.expectMessage("
|
94
|
+
expectedException.expectMessage("left and right strands must be of equal length.")
|
95
95
|
|
96
96
|
Hamming.compute("AATG", "AAA")
|
97
97
|
}
|
@@ -100,7 +100,7 @@ class HammingTest {
|
|
100
100
|
@Test
|
101
101
|
fun validatesSecondStrandNotLonger() {
|
102
102
|
expectedException.expect(IllegalArgumentException::class.java)
|
103
|
-
expectedException.expectMessage("
|
103
|
+
expectedException.expectMessage("left and right strands must be of equal length.")
|
104
104
|
|
105
105
|
Hamming.compute("ATA", "AGTG")
|
106
106
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1 @@
|
|
1
|
+
1.2.0
|
@@ -1,6 +1,4 @@
|
|
1
|
-
|
2
1
|
import org.junit.Test
|
3
|
-
import org.junit.Ignore
|
4
2
|
import org.junit.runner.RunWith
|
5
3
|
import org.junit.runners.Parameterized
|
6
4
|
import kotlin.test.assertEquals
|
@@ -12,22 +10,21 @@ class IsogramTest(val input: String, val expectedOutput: Boolean) {
|
|
12
10
|
@JvmStatic
|
13
11
|
@Parameterized.Parameters(name = "{index}: isogram({0})={1}")
|
14
12
|
fun data() = listOf(
|
15
|
-
arrayOf("
|
13
|
+
arrayOf("", true),
|
14
|
+
arrayOf("isogram", true),
|
16
15
|
arrayOf("eleven", false),
|
17
16
|
arrayOf("subdermatoglyphic", true),
|
18
17
|
arrayOf("Alphabet", false),
|
19
18
|
arrayOf("thumbscrew-japingly", true),
|
20
|
-
arrayOf("
|
21
|
-
arrayOf("Heizölrückstoßabdämpfung", true),
|
22
|
-
arrayOf("the quick brown fox", false),
|
19
|
+
arrayOf("six-year-old", true),
|
23
20
|
arrayOf("Emily Jung Schwartzkopf", true),
|
24
|
-
arrayOf("
|
21
|
+
arrayOf("accentor", false)
|
25
22
|
)
|
26
23
|
}
|
27
24
|
|
28
|
-
|
29
25
|
@Test
|
30
26
|
fun test() {
|
31
27
|
assertEquals(expectedOutput, Isogram.isIsogram(input))
|
32
28
|
}
|
29
|
+
|
33
30
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import java.lang.Math.max
|
2
2
|
|
3
|
-
class Series(val digits: String) {
|
3
|
+
class Series(private val digits: String) {
|
4
4
|
|
5
5
|
init {
|
6
6
|
require(digits.all { it.isDigit() })
|
@@ -14,7 +14,6 @@ class Series(val digits: String) {
|
|
14
14
|
return 1
|
15
15
|
}
|
16
16
|
|
17
|
-
|
18
17
|
return calculateRec(digits.map { it.intValue() }, span, 0)
|
19
18
|
}
|
20
19
|
|
@@ -42,4 +41,4 @@ fun Char.intDiff(other: Char) = this.toInt() - other.toInt()
|
|
42
41
|
|
43
42
|
fun List<Int>.prod() : Long = this.fold(1L) {productSoFar, item -> item*productSoFar}
|
44
43
|
|
45
|
-
fun <T> List<T>.tail() = this.subList(1, this.size)
|
44
|
+
fun <T> List<T>.tail() = this.subList(1, this.size)
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,97 @@
|
|
1
|
+
|
2
|
+
import org.junit.Test
|
3
|
+
import org.junit.Ignore
|
4
|
+
import kotlin.test.assertEquals
|
5
|
+
|
6
|
+
class SeriesTest {
|
7
|
+
|
8
|
+
@Test
|
9
|
+
fun findsTheLargestProductIfSpanEqualsLength() {
|
10
|
+
assertEquals(18, Series("29").getLargestProduct(2))
|
11
|
+
}
|
12
|
+
|
13
|
+
@Ignore
|
14
|
+
@Test
|
15
|
+
fun findsTheLargestProductOf2WithNumbersInOrder() {
|
16
|
+
assertEquals(72, Series("0123456789").getLargestProduct(2))
|
17
|
+
}
|
18
|
+
|
19
|
+
@Ignore
|
20
|
+
@Test
|
21
|
+
fun findsTheLargestProductOf2() {
|
22
|
+
assertEquals(48, Series("576802143").getLargestProduct(2))
|
23
|
+
}
|
24
|
+
|
25
|
+
@Ignore
|
26
|
+
@Test
|
27
|
+
fun findsTheLargestProductOf3WithNumbersInOrder() {
|
28
|
+
assertEquals(504, Series("0123456789").getLargestProduct(3))
|
29
|
+
}
|
30
|
+
|
31
|
+
@Ignore
|
32
|
+
@Test
|
33
|
+
fun findsTheLargestProductOf3() {
|
34
|
+
assertEquals(270, Series("1027839564").getLargestProduct(3))
|
35
|
+
}
|
36
|
+
|
37
|
+
@Ignore
|
38
|
+
@Test
|
39
|
+
fun findsTheLargestProductOf5WithNumbersInOrder() {
|
40
|
+
assertEquals(15120, Series("0123456789").getLargestProduct(5))
|
41
|
+
}
|
42
|
+
|
43
|
+
@Ignore
|
44
|
+
@Test
|
45
|
+
fun findsTheLargestProductWithinABigNumber() {
|
46
|
+
assertEquals(23520, Series("73167176531330624919225119674426574742355349194934").getLargestProduct(6))
|
47
|
+
}
|
48
|
+
|
49
|
+
@Ignore
|
50
|
+
@Test
|
51
|
+
fun reports0IfAllDigitsAre0() {
|
52
|
+
assertEquals(0, Series("0000").getLargestProduct(2))
|
53
|
+
}
|
54
|
+
|
55
|
+
@Ignore
|
56
|
+
@Test
|
57
|
+
fun reports0IfAllSpansInclude0() {
|
58
|
+
assertEquals(0, Series("99099").getLargestProduct(3))
|
59
|
+
}
|
60
|
+
|
61
|
+
@Ignore
|
62
|
+
@Test(expected = IllegalArgumentException::class)
|
63
|
+
fun rejectsSpanLongerThanStringLength() {
|
64
|
+
Series("123").getLargestProduct(4)
|
65
|
+
}
|
66
|
+
|
67
|
+
@Ignore
|
68
|
+
@Test
|
69
|
+
fun reports1ForEmptyStringAndEmptyProduct() {
|
70
|
+
assertEquals(1, Series("").getLargestProduct(0))
|
71
|
+
}
|
72
|
+
|
73
|
+
@Ignore
|
74
|
+
@Test
|
75
|
+
fun reports1ForNonEmptyStringAndEmptyProduct() {
|
76
|
+
assertEquals(1, Series("123").getLargestProduct(0))
|
77
|
+
}
|
78
|
+
|
79
|
+
@Ignore
|
80
|
+
@Test(expected = IllegalArgumentException::class)
|
81
|
+
fun rejectsEmptyStringAndNonZeroSpan() {
|
82
|
+
Series("").getLargestProduct(1)
|
83
|
+
}
|
84
|
+
|
85
|
+
@Ignore
|
86
|
+
@Test(expected = IllegalArgumentException::class)
|
87
|
+
fun rejectsInvalidCharacterInDigits() {
|
88
|
+
Series("1234a5")
|
89
|
+
}
|
90
|
+
|
91
|
+
@Ignore
|
92
|
+
@Test(expected = IllegalArgumentException::class)
|
93
|
+
fun rejectsNegativeSpan() {
|
94
|
+
Series("12345").getLargestProduct(-1)
|
95
|
+
}
|
96
|
+
|
97
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
@@ -5,45 +5,27 @@ import kotlin.test.assertTrue
|
|
5
5
|
|
6
6
|
class LeapTest {
|
7
7
|
|
8
|
-
|
9
|
-
@Test
|
10
|
-
fun leapYear() {
|
11
|
-
assertTrue(Year(1996).isLeap)
|
12
|
-
}
|
13
|
-
|
14
|
-
@Ignore
|
15
|
-
@Test
|
16
|
-
fun standardOddYear() {
|
17
|
-
assertFalse(Year(1997).isLeap)
|
18
|
-
}
|
19
|
-
|
20
|
-
@Ignore
|
21
8
|
@Test
|
22
|
-
fun
|
23
|
-
assertFalse(Year(
|
9
|
+
fun yearNotDivisibleBy4() {
|
10
|
+
assertFalse(Year(2015).isLeap)
|
24
11
|
}
|
25
12
|
|
26
13
|
@Ignore
|
27
14
|
@Test
|
28
|
-
fun
|
29
|
-
|
15
|
+
fun yearDivisibleBy4NotDivisibleBy100() {
|
16
|
+
assertTrue(Year(2020).isLeap)
|
30
17
|
}
|
31
18
|
|
32
19
|
@Ignore
|
33
20
|
@Test
|
34
|
-
fun
|
35
|
-
assertFalse(Year(
|
21
|
+
fun yearDivisibleBy100NotDivisibleBy400() {
|
22
|
+
assertFalse(Year(2100).isLeap)
|
36
23
|
}
|
37
24
|
|
38
25
|
@Ignore
|
39
26
|
@Test
|
40
|
-
fun
|
41
|
-
assertTrue(Year(2400).isLeap)
|
42
|
-
}
|
43
|
-
|
44
|
-
@Ignore
|
45
|
-
@Test
|
46
|
-
fun leapY2K() {
|
27
|
+
fun yearDivisibleBy400() {
|
47
28
|
assertTrue(Year(2000).isLeap)
|
48
29
|
}
|
30
|
+
|
49
31
|
}
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -5,7 +5,6 @@ import kotlin.test.assertTrue
|
|
5
5
|
|
6
6
|
class LuhnTest {
|
7
7
|
|
8
|
-
|
9
8
|
@Test
|
10
9
|
fun singleDigitStringsCannotBeValid() {
|
11
10
|
assertFalse(Luhn.isValid("1"))
|
@@ -21,14 +20,12 @@ class LuhnTest {
|
|
21
20
|
@Test
|
22
21
|
fun simpleValidSINThatRemainsValidIfReversed() {
|
23
22
|
assertTrue(Luhn.isValid("059"))
|
24
|
-
assertTrue(Luhn.isValid("950"))
|
25
23
|
}
|
26
24
|
|
27
25
|
@Ignore
|
28
26
|
@Test
|
29
27
|
fun simpleValidSINThatBecomesInvalidIfReversed() {
|
30
28
|
assertTrue(Luhn.isValid("59"))
|
31
|
-
assertFalse(Luhn.isValid("95"))
|
32
29
|
}
|
33
30
|
|
34
31
|
@Ignore
|