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
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -15,21 +15,22 @@ class AtbashTest {
|
|
15
15
|
@JvmStatic
|
16
16
|
@Parameterized.Parameters
|
17
17
|
fun data() = listOf(
|
18
|
-
arrayOf("no", "ml"),
|
19
18
|
arrayOf("yes", "bvh"),
|
19
|
+
arrayOf("no", "ml"),
|
20
20
|
arrayOf("OMG", "lnt"),
|
21
|
+
arrayOf("O M G", "lnt"),
|
21
22
|
arrayOf("mindblowingly", "nrmwy oldrm tob"),
|
22
|
-
arrayOf("Testing,
|
23
|
+
arrayOf("Testing,1 2 3, testing.", "gvhgr mt123 gvhgr mt"),
|
23
24
|
arrayOf("Truth is fiction.", "gifgs rhurx grlm"),
|
24
25
|
arrayOf("The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")
|
25
26
|
)
|
26
27
|
}
|
27
28
|
|
28
|
-
|
29
29
|
@Test
|
30
30
|
fun test() {
|
31
31
|
assertEquals(expectedOutput, Atbash.encode(input))
|
32
32
|
}
|
33
|
+
|
33
34
|
}
|
34
35
|
|
35
36
|
@RunWith(Parameterized::class)
|
@@ -50,5 +51,7 @@ class AtbashTest {
|
|
50
51
|
fun test() {
|
51
52
|
assertEquals(expectedOutput, Atbash.decode(input))
|
52
53
|
}
|
54
|
+
|
53
55
|
}
|
56
|
+
|
54
57
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -1,22 +1,20 @@
|
|
1
|
-
import org.junit.Test
|
2
1
|
import org.junit.Ignore
|
2
|
+
import org.junit.Test
|
3
3
|
import kotlin.test.assertEquals
|
4
|
-
import kotlin.test.assertFailsWith
|
5
4
|
|
6
5
|
class BeerSongTest {
|
7
6
|
|
8
|
-
|
9
7
|
@Test
|
10
|
-
fun
|
11
|
-
val expected = "
|
12
|
-
assertEquals(expected, BeerSong.verse(
|
8
|
+
fun firstGenericVerse() {
|
9
|
+
val expected = "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n"
|
10
|
+
assertEquals(expected, BeerSong.verse(99))
|
13
11
|
}
|
14
12
|
|
15
13
|
@Ignore
|
16
14
|
@Test
|
17
|
-
fun
|
18
|
-
val expected = "
|
19
|
-
assertEquals(expected, BeerSong.verse(
|
15
|
+
fun lastGenericVerse() {
|
16
|
+
val expected = "3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n"
|
17
|
+
assertEquals(expected, BeerSong.verse(3))
|
20
18
|
}
|
21
19
|
|
22
20
|
@Ignore
|
@@ -28,59 +26,35 @@ class BeerSongTest {
|
|
28
26
|
|
29
27
|
@Ignore
|
30
28
|
@Test
|
31
|
-
fun
|
32
|
-
val expected = "
|
33
|
-
assertEquals(expected, BeerSong.verse(
|
34
|
-
}
|
35
|
-
|
36
|
-
@Ignore
|
37
|
-
@Test
|
38
|
-
fun verse99() {
|
39
|
-
val expected = "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n"
|
40
|
-
assertEquals(expected, BeerSong.verse(99))
|
41
|
-
}
|
42
|
-
|
43
|
-
@Ignore
|
44
|
-
@Test
|
45
|
-
fun verseMinus1() {
|
46
|
-
assertFailsWith(IllegalArgumentException::class, "Beer song verse can't be negative", { BeerSong.verse(-1) })
|
47
|
-
}
|
48
|
-
|
49
|
-
@Ignore
|
50
|
-
@Test
|
51
|
-
fun verse100() {
|
52
|
-
assertFailsWith(IllegalArgumentException::class, "Beer song only goes up to verse 99", { BeerSong.verse(100) })
|
53
|
-
}
|
54
|
-
|
55
|
-
@Ignore
|
56
|
-
@Test
|
57
|
-
fun songVerse8To6() {
|
58
|
-
val expected = "8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n"
|
59
|
-
assertEquals(expected, BeerSong.verses(8, 6))
|
29
|
+
fun verse1() {
|
30
|
+
val expected = "1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n"
|
31
|
+
assertEquals(expected, BeerSong.verse(1))
|
60
32
|
}
|
61
33
|
|
62
34
|
@Ignore
|
63
35
|
@Test
|
64
|
-
fun
|
65
|
-
val expected = "
|
66
|
-
assertEquals(expected, BeerSong.
|
36
|
+
fun verse0() {
|
37
|
+
val expected = "No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
38
|
+
assertEquals(expected, BeerSong.verse(0))
|
67
39
|
}
|
68
40
|
|
69
41
|
@Ignore
|
70
42
|
@Test
|
71
|
-
fun
|
72
|
-
|
43
|
+
fun firstTwoVerses() {
|
44
|
+
val expected = "99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n98 bottles of beer on the wall, 98 bottles of beer.\nTake one down and pass it around, 97 bottles of beer on the wall.\n"
|
45
|
+
assertEquals(expected, BeerSong.verses(99, 98))
|
73
46
|
}
|
74
47
|
|
75
48
|
@Ignore
|
76
49
|
@Test
|
77
|
-
fun
|
78
|
-
|
50
|
+
fun lastThreeVerses() {
|
51
|
+
val expected = "2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n"
|
52
|
+
assertEquals(expected, BeerSong.verses(2, 0))
|
79
53
|
}
|
80
54
|
|
81
55
|
@Ignore
|
82
56
|
@Test
|
83
|
-
fun
|
57
|
+
fun allVerses() {
|
84
58
|
val expected =
|
85
59
|
"""99 bottles of beer on the wall, 99 bottles of beer.
|
86
60
|
Take one down and pass it around, 98 bottles of beer on the wall.
|
@@ -384,4 +358,5 @@ Go to the store and buy some more, 99 bottles of beer on the wall.
|
|
384
358
|
"""
|
385
359
|
assertEquals(expected, BeerSong.lyrics)
|
386
360
|
}
|
361
|
+
|
387
362
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -1,55 +1,66 @@
|
|
1
|
-
|
2
|
-
import org.junit.Test
|
3
1
|
import org.junit.Ignore
|
2
|
+
import org.junit.Test
|
4
3
|
import kotlin.test.assertEquals
|
5
4
|
|
6
5
|
class BinarySearchTest {
|
7
6
|
|
7
|
+
@Test
|
8
|
+
fun findsTheItemInASingleElementList() {
|
9
|
+
assertEquals(0, BinarySearch.search(listOf(6), 6))
|
10
|
+
}
|
11
|
+
|
12
|
+
@Ignore
|
13
|
+
@Test
|
14
|
+
fun findsTheItemInTheMiddleOfAList() {
|
15
|
+
assertEquals(3, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 6))
|
16
|
+
}
|
8
17
|
|
9
|
-
@
|
10
|
-
|
11
|
-
|
18
|
+
@Ignore
|
19
|
+
@Test
|
20
|
+
fun findsTheItemAtTheBeginningOfAList() {
|
21
|
+
assertEquals(0, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 1))
|
12
22
|
}
|
13
23
|
|
14
24
|
@Ignore
|
15
25
|
@Test
|
16
|
-
fun
|
17
|
-
assertEquals(
|
26
|
+
fun findsTheItemAtTheEndOfAList() {
|
27
|
+
assertEquals(6, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 11))
|
18
28
|
}
|
19
29
|
|
20
30
|
@Ignore
|
21
31
|
@Test
|
22
|
-
fun
|
23
|
-
assertEquals(
|
32
|
+
fun findsValueInAListOfOddLength() {
|
33
|
+
assertEquals(9, BinarySearch.search(listOf(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634), 144))
|
24
34
|
}
|
25
35
|
|
26
36
|
@Ignore
|
27
37
|
@Test
|
28
|
-
fun
|
29
|
-
assertEquals(
|
38
|
+
fun findsValueInAListOfEvenLength() {
|
39
|
+
assertEquals(5, BinarySearch.search(listOf(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377), 21))
|
30
40
|
}
|
31
41
|
|
32
42
|
@Ignore
|
33
43
|
@Test
|
34
|
-
fun
|
35
|
-
assertEquals(1, BinarySearch.search(listOf(4, 11),
|
44
|
+
fun identifiesThatAValueIsNotInTheList() {
|
45
|
+
assertEquals(-1, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 7))
|
36
46
|
}
|
37
47
|
|
38
48
|
@Ignore
|
39
49
|
@Test
|
40
|
-
fun
|
41
|
-
assertEquals(
|
50
|
+
fun identifiesThatAValueSmallerThanTheSmallestListElementIsNotInTheList() {
|
51
|
+
assertEquals(-1, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 0))
|
42
52
|
}
|
43
53
|
|
44
54
|
@Ignore
|
45
55
|
@Test
|
46
|
-
fun
|
47
|
-
assertEquals(1, BinarySearch.search(listOf(4,
|
56
|
+
fun identifiesThatAValueLargerThanTheLargestListElementIsNotInTheList() {
|
57
|
+
assertEquals(-1, BinarySearch.search(listOf(1, 3, 4, 6, 8, 9, 11), 13))
|
48
58
|
}
|
49
59
|
|
50
60
|
@Ignore
|
51
61
|
@Test
|
52
|
-
fun
|
53
|
-
assertEquals(
|
62
|
+
fun identifiesThatNothingCanBeFoundInAnEmptyList() {
|
63
|
+
assertEquals(-1, BinarySearch.search(emptyList(), 1))
|
54
64
|
}
|
65
|
+
|
55
66
|
}
|
@@ -1,18 +1,19 @@
|
|
1
|
-
/**
|
2
|
-
* Bob is a lackadasical teenager.
|
3
|
-
*/
|
4
1
|
object Bob {
|
5
2
|
fun hey(input: String): String {
|
3
|
+
val trimmedInput = input.trim()
|
4
|
+
|
6
5
|
return when {
|
7
|
-
isSilence(
|
8
|
-
isShout(
|
9
|
-
isQuestion(
|
10
|
-
else
|
6
|
+
isSilence(trimmedInput) -> "Fine. Be that way!"
|
7
|
+
isShout(trimmedInput) -> "Whoa, chill out!"
|
8
|
+
isQuestion(trimmedInput) -> "Sure."
|
9
|
+
else -> "Whatever."
|
11
10
|
}
|
12
11
|
}
|
13
12
|
|
14
13
|
private fun isSilence(input: String) = input.isBlank()
|
14
|
+
|
15
15
|
private fun isQuestion(input: String) = input.endsWith("?")
|
16
|
+
|
16
17
|
private fun isShout(input: String): Boolean {
|
17
18
|
val isOnlyUppercase = input == input.toUpperCase()
|
18
19
|
val hasLetter = input.contains(Regex("[A-Z]"))
|
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -4,7 +4,6 @@ import kotlin.test.assertEquals
|
|
4
4
|
|
5
5
|
class BobTest {
|
6
6
|
|
7
|
-
|
8
7
|
@Test
|
9
8
|
fun saySomething() {
|
10
9
|
assertEquals("Whatever.", Bob.hey("Tom-ay-to, tom-aaaah-to."))
|
@@ -16,6 +15,12 @@ class BobTest {
|
|
16
15
|
assertEquals("Whoa, chill out!", Bob.hey("WATCH OUT!"))
|
17
16
|
}
|
18
17
|
|
18
|
+
@Ignore
|
19
|
+
@Test
|
20
|
+
fun shoutingGibberish() {
|
21
|
+
assertEquals("Whoa, chill out!", Bob.hey("FCECDFCAAB"))
|
22
|
+
}
|
23
|
+
|
19
24
|
@Ignore
|
20
25
|
@Test
|
21
26
|
fun askingAQuestion() {
|
@@ -28,6 +33,12 @@ class BobTest {
|
|
28
33
|
assertEquals("Sure.", Bob.hey("You are, what, like 15?"))
|
29
34
|
}
|
30
35
|
|
36
|
+
@Ignore
|
37
|
+
@Test
|
38
|
+
fun askingGibberish() {
|
39
|
+
assertEquals("Sure.", Bob.hey("fffbbcbeab?"))
|
40
|
+
}
|
41
|
+
|
31
42
|
@Ignore
|
32
43
|
@Test
|
33
44
|
fun talkingForcefully() {
|
@@ -42,7 +53,7 @@ class BobTest {
|
|
42
53
|
|
43
54
|
@Ignore
|
44
55
|
@Test
|
45
|
-
fun
|
56
|
+
fun forcefulQuestion() {
|
46
57
|
assertEquals("Whoa, chill out!", Bob.hey("WHAT THE HELL WERE YOU THINKING?"))
|
47
58
|
}
|
48
59
|
|
@@ -70,18 +81,6 @@ class BobTest {
|
|
70
81
|
assertEquals("Whoa, chill out!", Bob.hey("ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!"))
|
71
82
|
}
|
72
83
|
|
73
|
-
@Ignore
|
74
|
-
@Test
|
75
|
-
fun shoutingWithUmlauts() {
|
76
|
-
assertEquals("Whoa, chill out!", Bob.hey("\u00dcML\u00c4\u00dcTS!"))
|
77
|
-
}
|
78
|
-
|
79
|
-
@Ignore
|
80
|
-
@Test
|
81
|
-
fun calmlySpeakingWithUmlauts() {
|
82
|
-
assertEquals("Whatever.", Bob.hey("\u00dcML\u00e4\u00dcTS!"))
|
83
|
-
}
|
84
|
-
|
85
84
|
@Ignore
|
86
85
|
@Test
|
87
86
|
fun shoutingWithNoExclamationMark() {
|
@@ -94,6 +93,12 @@ class BobTest {
|
|
94
93
|
assertEquals("Whatever.", Bob.hey("Ending with ? means a question."))
|
95
94
|
}
|
96
95
|
|
96
|
+
@Ignore
|
97
|
+
@Test
|
98
|
+
fun nonLettersWithQuestion() {
|
99
|
+
assertEquals("Sure.", Bob.hey(":) ?"))
|
100
|
+
}
|
101
|
+
|
97
102
|
@Ignore
|
98
103
|
@Test
|
99
104
|
fun prattlingOn() {
|
@@ -109,6 +114,43 @@ class BobTest {
|
|
109
114
|
@Ignore
|
110
115
|
@Test
|
111
116
|
fun prolongedSilence() {
|
112
|
-
assertEquals("Fine. Be that way!", Bob.hey("
|
117
|
+
assertEquals("Fine. Be that way!", Bob.hey(" "))
|
118
|
+
}
|
119
|
+
|
120
|
+
@Ignore
|
121
|
+
@Test
|
122
|
+
fun alternateSilence() {
|
123
|
+
assertEquals("Fine. Be that way!", Bob.hey("\t\t\t\t\t\t\t\t\t\t"))
|
124
|
+
}
|
125
|
+
|
126
|
+
@Ignore
|
127
|
+
@Test
|
128
|
+
fun multipleLineQuestion() {
|
129
|
+
assertEquals("Whatever.", Bob.hey("\nDoes this cryogenic chamber make me look fat?\nno"))
|
113
130
|
}
|
131
|
+
|
132
|
+
@Ignore
|
133
|
+
@Test
|
134
|
+
fun startingWithWhitespace() {
|
135
|
+
assertEquals("Whatever.", Bob.hey(" hmmmmmmm..."))
|
136
|
+
}
|
137
|
+
|
138
|
+
@Ignore
|
139
|
+
@Test
|
140
|
+
fun endingWithWhitespace() {
|
141
|
+
assertEquals("Sure.", Bob.hey("Okay if like my spacebar quite a bit? "))
|
142
|
+
}
|
143
|
+
|
144
|
+
@Ignore
|
145
|
+
@Test
|
146
|
+
fun otherWhitespace() {
|
147
|
+
assertEquals("Fine. Be that way!", Bob.hey("\n\r \t"))
|
148
|
+
}
|
149
|
+
|
150
|
+
@Ignore
|
151
|
+
@Test
|
152
|
+
fun nonQuestionEndingWithWhitespace() {
|
153
|
+
assertEquals("Whatever.", Bob.hey("This is a statement ending with whitespace "))
|
154
|
+
}
|
155
|
+
|
114
156
|
}
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
@@ -16,10 +16,12 @@ class BracketPushTest(val input: String, val expectedOutput: Boolean) {
|
|
16
16
|
arrayOf("", true),
|
17
17
|
arrayOf("[[", false),
|
18
18
|
arrayOf("}{", false),
|
19
|
+
arrayOf("{]", false),
|
19
20
|
arrayOf("{ }", true),
|
20
21
|
arrayOf("{[]}", true),
|
21
22
|
arrayOf("{}[]", true),
|
22
23
|
arrayOf("([{}({}[])])", true),
|
24
|
+
arrayOf("{[)][]}", false),
|
23
25
|
arrayOf("([{])", false),
|
24
26
|
arrayOf("[({]})", false),
|
25
27
|
arrayOf("(((185 + 223.85) * 15) - 543)/2", true),
|
@@ -27,9 +29,9 @@ class BracketPushTest(val input: String, val expectedOutput: Boolean) {
|
|
27
29
|
)
|
28
30
|
}
|
29
31
|
|
30
|
-
|
31
32
|
@Test
|
32
33
|
fun test() {
|
33
34
|
assertEquals(expectedOutput, BracketPush.isValid(input))
|
34
35
|
}
|
36
|
+
|
35
37
|
}
|
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
@@ -0,0 +1 @@
|
|
1
|
+
1.1.0
|
@@ -4,16 +4,15 @@ import kotlin.test.assertEquals
|
|
4
4
|
|
5
5
|
class SquaresTest {
|
6
6
|
|
7
|
-
|
8
7
|
@Test
|
9
|
-
fun
|
10
|
-
assertEquals(
|
8
|
+
fun squareOfSum1() {
|
9
|
+
assertEquals(1, Squares(1).squareOfSum())
|
11
10
|
}
|
12
11
|
|
13
12
|
@Ignore
|
14
13
|
@Test
|
15
|
-
fun
|
16
|
-
assertEquals(
|
14
|
+
fun squareOfSum5() {
|
15
|
+
assertEquals(225, Squares(5).squareOfSum())
|
17
16
|
}
|
18
17
|
|
19
18
|
@Ignore
|
@@ -24,14 +23,14 @@ class SquaresTest {
|
|
24
23
|
|
25
24
|
@Ignore
|
26
25
|
@Test
|
27
|
-
fun
|
28
|
-
assertEquals(
|
26
|
+
fun sumOfSquares1() {
|
27
|
+
assertEquals(1, Squares(1).sumOfSquares())
|
29
28
|
}
|
30
29
|
|
31
30
|
@Ignore
|
32
31
|
@Test
|
33
|
-
fun
|
34
|
-
assertEquals(
|
32
|
+
fun sumOfSquares5() {
|
33
|
+
assertEquals(55, Squares(5).sumOfSquares())
|
35
34
|
}
|
36
35
|
|
37
36
|
@Ignore
|
@@ -42,8 +41,8 @@ class SquaresTest {
|
|
42
41
|
|
43
42
|
@Ignore
|
44
43
|
@Test
|
45
|
-
fun
|
46
|
-
assertEquals(0, Squares(
|
44
|
+
fun differenceOfSquares1() {
|
45
|
+
assertEquals(0, Squares(1).difference())
|
47
46
|
}
|
48
47
|
|
49
48
|
@Ignore
|
@@ -52,22 +51,10 @@ class SquaresTest {
|
|
52
51
|
assertEquals(170, Squares(5).difference())
|
53
52
|
}
|
54
53
|
|
55
|
-
@Ignore
|
56
|
-
@Test
|
57
|
-
fun differenceOfSquares10() {
|
58
|
-
assertEquals(2640, Squares(10).difference())
|
59
|
-
}
|
60
|
-
|
61
54
|
@Ignore
|
62
55
|
@Test
|
63
56
|
fun differenceOfSquares100() {
|
64
57
|
assertEquals(25164150, Squares(100).difference())
|
65
58
|
}
|
66
59
|
|
67
|
-
@Ignore
|
68
|
-
@Test
|
69
|
-
fun consistentDifference() {
|
70
|
-
assertEquals(Squares(0).difference(), Squares(0).difference())
|
71
|
-
}
|
72
|
-
|
73
60
|
}
|