trackler 2.0.8.28 → 2.0.8.29
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/common/CONTRIBUTING.md +4 -1
- data/common/README.md +52 -0
- data/lib/trackler/version.rb +1 -1
- data/tracks/ecmascript/config.json +7 -0
- data/tracks/ecmascript/exercises/perfect-numbers/example.js +68 -0
- data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +89 -0
- data/tracks/ecmascript/exercises/perfect-numbers/package.json +28 -0
- data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +75 -0
- data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +1 -1
- data/tracks/erlang/exercises/all-your-base/src/all_your_base.app.src +1 -1
- data/tracks/erlang/exercises/allergies/src/allergies.app.src +1 -1
- data/tracks/erlang/exercises/anagram/src/anagram.app.src +1 -1
- data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +1 -1
- data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +1 -1
- data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +1 -1
- data/tracks/erlang/exercises/bob/src/bob.app.src +1 -1
- data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +1 -1
- data/tracks/erlang/exercises/clock/src/clock.app.src +1 -1
- data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +1 -1
- data/tracks/erlang/exercises/etl/src/etl.app.src +1 -1
- data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +1 -1
- data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +1 -1
- data/tracks/erlang/exercises/grains/src/grains.app.src +1 -1
- data/tracks/erlang/exercises/hamming/src/hamming.app.src +1 -1
- data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +1 -1
- data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +1 -1
- data/tracks/erlang/exercises/leap/src/leap.app.src +1 -1
- data/tracks/erlang/exercises/luhn/src/luhn.app.src +1 -1
- data/tracks/erlang/exercises/meetup/src/meetup.app.src +1 -1
- data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +1 -1
- data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +1 -1
- data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +1 -1
- data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +1 -1
- data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +1 -1
- data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +1 -1
- data/tracks/erlang/exercises/rotational-cipher/src/rotational_cipher.app.src +1 -1
- data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +1 -1
- data/tracks/erlang/exercises/series/src/series.app.src +1 -1
- data/tracks/erlang/exercises/space-age/src/space_age.app.src +1 -1
- data/tracks/erlang/exercises/strain/src/strain.app.src +1 -1
- data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +1 -1
- data/tracks/erlang/exercises/triangle/src/triangle.app.src +1 -1
- data/tracks/erlang/exercises/word-count/src/word_count.app.src +1 -1
- data/tracks/erlang/exercises/zipper/src/zipper.app.src +1 -1
- data/tracks/go/exercises/hello-world/hello_world.go +10 -1
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/src/LinkedList.hs +1 -0
- data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
- data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +1 -1
- data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +37 -1
- data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +13 -6
- data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +21 -13
- data/tracks/objective-c/exercises/atbash-cipher/AtbashCipherExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongExample.m +1 -1
- data/tracks/objective-c/exercises/beer-song/BeerSongTest.m +4 -4
- data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +1 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +2 -1
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +12 -25
- data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +32 -80
- data/tracks/objective-c/exercises/sublist/SublistTest.m +47 -70
- data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -0
- data/tracks/perl6/exercises/allergies/Example.pm +3 -1
- data/tracks/perl6/exercises/allergies/allergies.t +187 -137
- data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -0
- data/tracks/perl6/exercises/anagram/Example.pm +15 -15
- data/tracks/perl6/exercises/anagram/anagram.t +164 -15
- data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -0
- data/tracks/perl6/exercises/atbash-cipher/Example.pm +2 -0
- data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +109 -86
- data/tracks/perl6/exercises/grains/Example.pm +10 -9
- data/tracks/perl6/exercises/grains/Grains.pm6 +1 -0
- data/tracks/perl6/exercises/grains/grains.t +126 -18
- data/tracks/perl6/exercises/leap/Example.pm +9 -9
- data/tracks/perl6/exercises/leap/Leap.pm6 +4 -0
- data/tracks/perl6/exercises/leap/leap.t +61 -17
- data/tracks/perl6/exercises/phone-number/Example.pm +4 -28
- data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +4 -0
- data/tracks/perl6/exercises/phone-number/phone-number.t +102 -65
- data/tracks/perl6/exercises/raindrops/Example.pm +10 -8
- data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +4 -0
- data/tracks/perl6/exercises/raindrops/raindrops.t +153 -20
- data/tracks/perl6/exercises/rna-transcription/Example.pm +5 -7
- data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +4 -0
- data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +107 -11
- data/tracks/perl6/exercises/scrabble-score/Example.pm +14 -19
- data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +4 -0
- data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +106 -15
- data/tracks/perl6/exercises/space-age/Example.pm +29 -13
- data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +22 -0
- data/tracks/perl6/exercises/space-age/space-age.t +90 -52
- data/tracks/perl6/exercises/word-count/Example.pm +4 -8
- data/tracks/perl6/exercises/word-count/WordCount.pm6 +4 -0
- data/tracks/perl6/exercises/word-count/word-count.t +149 -16
- data/tracks/perl6/exercises/wordy/Example.pm +13 -13
- data/tracks/perl6/exercises/wordy/Wordy.pm6 +4 -0
- data/tracks/perl6/exercises/wordy/wordy.t +140 -97
- data/tracks/purescript/config.json +7 -0
- data/tracks/purescript/exercises/atbash-cipher/bower.json +18 -0
- data/tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs +41 -0
- data/tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs +4 -0
- data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +64 -0
- data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +2 -0
- data/tracks/swift/exercises/grade-school/Tests/GradeSchoolTests/GradeSchoolTests.swift +1 -1
- metadata +22 -2
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
|
|
4
4
|
// Package greeting should have a package comment that summarizes what it's about.
|
|
5
5
|
// https://golang.org/doc/effective_go.html#commentary
|
|
6
|
+
// While documentation is taken very seriously in Go, and tools like golint will
|
|
7
|
+
// complain if you don't include it, these comments are not required to make
|
|
8
|
+
// the test suite pass. It is up to you whether to include them in your submitted
|
|
9
|
+
// exercises.
|
|
10
|
+
// You can read more about the importance of documentation in Go here:
|
|
11
|
+
// https://blog.golang.org/godoc-documenting-go-code
|
|
6
12
|
package greeting
|
|
7
13
|
|
|
8
14
|
// testVersion identifies the version of the test program that you are
|
|
@@ -22,7 +28,10 @@ package greeting
|
|
|
22
28
|
// information.
|
|
23
29
|
const testVersion = 4
|
|
24
30
|
|
|
25
|
-
// HelloWorld
|
|
31
|
+
// HelloWorld should have a comment documenting it, beginning with the name of
|
|
32
|
+
// the function. It is recommended good practice, but, as we mention above, it's
|
|
33
|
+
// not necessary for making your solutions pass.
|
|
34
|
+
// https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences
|
|
26
35
|
func HelloWorld() string {
|
|
27
36
|
// Write some code here to pass the test suite.
|
|
28
37
|
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
+
{-# LANGUAGE ScopedTypeVariables #-}
|
|
2
|
+
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
|
3
|
+
|
|
1
4
|
import Test.Hspec (Spec, describe, it, shouldBe)
|
|
2
5
|
import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
|
|
6
|
+
import Test.QuickCheck (property)
|
|
7
|
+
import Test.QuickCheck.Arbitrary
|
|
3
8
|
|
|
4
9
|
import LinkedList
|
|
5
10
|
( datum
|
|
@@ -10,8 +15,16 @@ import LinkedList
|
|
|
10
15
|
, nil
|
|
11
16
|
, reverseLinkedList
|
|
12
17
|
, toList
|
|
18
|
+
, LinkedList
|
|
13
19
|
)
|
|
14
20
|
|
|
21
|
+
instance (Arbitrary a) => Arbitrary (LinkedList a) where
|
|
22
|
+
arbitrary = fromList <$> arbitrary
|
|
23
|
+
|
|
24
|
+
nthDatum :: LinkedList a -> Int -> a
|
|
25
|
+
nthDatum xs 0 = datum xs
|
|
26
|
+
nthDatum xs n = nthDatum (next xs) (pred n)
|
|
27
|
+
|
|
15
28
|
main :: IO ()
|
|
16
29
|
main = hspecWith defaultConfig {configFastFail = True} specs
|
|
17
30
|
|
|
@@ -55,7 +68,7 @@ specs = describe "simple-linked-list" $ do
|
|
|
55
68
|
datum (next fl21) `shouldBe` 1
|
|
56
69
|
isNil (next $ next fl21) `shouldBe` True
|
|
57
70
|
|
|
58
|
-
it "
|
|
71
|
+
it "reverseLinkedList" $ do
|
|
59
72
|
isNil (reverseLinkedList nil) `shouldBe` True
|
|
60
73
|
datum r1 `shouldBe` 1
|
|
61
74
|
isNil (next r1) `shouldBe` True
|
|
@@ -75,3 +88,26 @@ specs = describe "simple-linked-list" $ do
|
|
|
75
88
|
it "has an unconstrained type variable" $ do
|
|
76
89
|
(toList . fromList) msg `shouldBe` msg
|
|
77
90
|
(toList . fromList) [1..10] `shouldBe` ([1..10] :: [Integer])
|
|
91
|
+
|
|
92
|
+
it "arbitrary reverseLinkedList" $
|
|
93
|
+
property $ \(xs :: LinkedList Int) ->
|
|
94
|
+
reverseLinkedList xs == (fromList . reverse . toList) xs
|
|
95
|
+
|
|
96
|
+
it "arbitrary (fromList . toList)" $
|
|
97
|
+
property $ \(xs :: LinkedList Int) ->
|
|
98
|
+
(fromList . toList) xs == xs
|
|
99
|
+
|
|
100
|
+
it "arbitrary (toList . fromList)" $
|
|
101
|
+
property $ \(xs :: [Int]) ->
|
|
102
|
+
(toList . fromList) xs == xs
|
|
103
|
+
|
|
104
|
+
it "arbitrary (reverseLinkedList . reverseLinkedList)" $
|
|
105
|
+
property $ \(xs :: LinkedList Int) ->
|
|
106
|
+
(reverseLinkedList . reverseLinkedList) xs == xs
|
|
107
|
+
|
|
108
|
+
it "arbitrary datum" $
|
|
109
|
+
property $ \(xs :: [Int]) ->
|
|
110
|
+
let ll = fromList xs
|
|
111
|
+
sameNthDatum n = nthDatum ll n == xs !! n
|
|
112
|
+
indices = [0..pred $ length xs] in
|
|
113
|
+
all sameNthDatum indices
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import org.junit.Ignore;
|
|
2
|
+
import org.junit.Before;
|
|
2
3
|
import org.junit.Test;
|
|
3
4
|
|
|
4
5
|
import java.util.List;
|
|
@@ -9,17 +10,23 @@ import static org.hamcrest.CoreMatchers.is;
|
|
|
9
10
|
import static org.junit.Assert.assertThat;
|
|
10
11
|
|
|
11
12
|
public final class DiamondPrinterTest {
|
|
12
|
-
|
|
13
|
+
private DiamondPrinter diamondPrinter;
|
|
14
|
+
|
|
15
|
+
@Before
|
|
16
|
+
public void setUp() {
|
|
17
|
+
diamondPrinter = new DiamondPrinter();
|
|
18
|
+
}
|
|
19
|
+
|
|
13
20
|
@Test
|
|
14
21
|
public void testOneByOneDiamond() {
|
|
15
|
-
List<String> output =
|
|
22
|
+
List<String> output = diamondPrinter.printToList('A');
|
|
16
23
|
assertThat(output, is(singletonList("A")));
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
@Ignore
|
|
20
27
|
@Test
|
|
21
28
|
public void testTwoByTwoDiamond() {
|
|
22
|
-
List<String> output =
|
|
29
|
+
List<String> output = diamondPrinter.printToList('B');
|
|
23
30
|
assertThat(output, is(asList(" A ",
|
|
24
31
|
"B B",
|
|
25
32
|
" A ")));
|
|
@@ -28,7 +35,7 @@ public final class DiamondPrinterTest {
|
|
|
28
35
|
@Ignore
|
|
29
36
|
@Test
|
|
30
37
|
public void testThreeByThreeDiamond() {
|
|
31
|
-
List<String> output =
|
|
38
|
+
List<String> output = diamondPrinter.printToList('C');
|
|
32
39
|
assertThat(output, is(asList(" A ",
|
|
33
40
|
" B B ",
|
|
34
41
|
"C C",
|
|
@@ -39,7 +46,7 @@ public final class DiamondPrinterTest {
|
|
|
39
46
|
@Ignore
|
|
40
47
|
@Test
|
|
41
48
|
public void testFiveByFiveDiamond() {
|
|
42
|
-
List<String> output =
|
|
49
|
+
List<String> output = diamondPrinter.printToList('E');
|
|
43
50
|
assertThat(output, is(asList(" A ",
|
|
44
51
|
" B B ",
|
|
45
52
|
" C C ",
|
|
@@ -54,7 +61,7 @@ public final class DiamondPrinterTest {
|
|
|
54
61
|
@Ignore
|
|
55
62
|
@Test
|
|
56
63
|
public void testFullDiamond() {
|
|
57
|
-
List<String> output =
|
|
64
|
+
List<String> output = diamondPrinter.printToList('Z');
|
|
58
65
|
assertThat(output, is(asList(" A ",
|
|
59
66
|
" B B ",
|
|
60
67
|
" C C ",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import org.junit.Ignore;
|
|
2
|
+
import org.junit.Before;
|
|
2
3
|
import org.junit.Test;
|
|
3
4
|
|
|
4
5
|
import static java.util.Arrays.asList;
|
|
@@ -7,12 +8,19 @@ import static java.util.Collections.singletonList;
|
|
|
7
8
|
import static org.junit.Assert.assertEquals;
|
|
8
9
|
|
|
9
10
|
public final class HandshakeCalculatorTest {
|
|
10
|
-
|
|
11
|
+
private HandshakeCalculator handshakeCalculator;
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@Before
|
|
15
|
+
public void setUp() {
|
|
16
|
+
handshakeCalculator = new HandshakeCalculator();
|
|
17
|
+
}
|
|
18
|
+
|
|
11
19
|
@Test
|
|
12
20
|
public void testThatInput1YieldsAWink() {
|
|
13
21
|
assertEquals(
|
|
14
22
|
singletonList(Signal.WINK),
|
|
15
|
-
|
|
23
|
+
handshakeCalculator.calculateHandshake(1));
|
|
16
24
|
}
|
|
17
25
|
|
|
18
26
|
@Ignore
|
|
@@ -20,7 +28,7 @@ public final class HandshakeCalculatorTest {
|
|
|
20
28
|
public void testThatInput2YieldsADoubleBlink() {
|
|
21
29
|
assertEquals(
|
|
22
30
|
singletonList(Signal.DOUBLE_BLINK),
|
|
23
|
-
|
|
31
|
+
handshakeCalculator.calculateHandshake(2));
|
|
24
32
|
}
|
|
25
33
|
|
|
26
34
|
@Ignore
|
|
@@ -28,7 +36,7 @@ public final class HandshakeCalculatorTest {
|
|
|
28
36
|
public void testThatInput4YieldsACloseYourEyes() {
|
|
29
37
|
assertEquals(
|
|
30
38
|
singletonList(Signal.CLOSE_YOUR_EYES),
|
|
31
|
-
|
|
39
|
+
handshakeCalculator.calculateHandshake(4));
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
@Ignore
|
|
@@ -36,7 +44,7 @@ public final class HandshakeCalculatorTest {
|
|
|
36
44
|
public void testThatInput8YieldsAJump() {
|
|
37
45
|
assertEquals(
|
|
38
46
|
singletonList(Signal.JUMP),
|
|
39
|
-
|
|
47
|
+
handshakeCalculator.calculateHandshake(8));
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
@Ignore
|
|
@@ -44,7 +52,7 @@ public final class HandshakeCalculatorTest {
|
|
|
44
52
|
public void testAnInputThatYieldsTwoActions() {
|
|
45
53
|
assertEquals(
|
|
46
54
|
asList(Signal.WINK, Signal.DOUBLE_BLINK),
|
|
47
|
-
|
|
55
|
+
handshakeCalculator.calculateHandshake(3));
|
|
48
56
|
}
|
|
49
57
|
|
|
50
58
|
@Ignore
|
|
@@ -52,7 +60,7 @@ public final class HandshakeCalculatorTest {
|
|
|
52
60
|
public void testAnInputThatYieldsTwoReversedActions() {
|
|
53
61
|
assertEquals(
|
|
54
62
|
asList(Signal.DOUBLE_BLINK, Signal.WINK),
|
|
55
|
-
|
|
63
|
+
handshakeCalculator.calculateHandshake(19));
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
@Ignore
|
|
@@ -60,7 +68,7 @@ public final class HandshakeCalculatorTest {
|
|
|
60
68
|
public void testReversingASingleActionYieldsTheSameAction() {
|
|
61
69
|
assertEquals(
|
|
62
70
|
singletonList(Signal.JUMP),
|
|
63
|
-
|
|
71
|
+
handshakeCalculator.calculateHandshake(24));
|
|
64
72
|
}
|
|
65
73
|
|
|
66
74
|
@Ignore
|
|
@@ -68,7 +76,7 @@ public final class HandshakeCalculatorTest {
|
|
|
68
76
|
public void testReversingNoActionsYieldsNoActions() {
|
|
69
77
|
assertEquals(
|
|
70
78
|
emptyList(),
|
|
71
|
-
|
|
79
|
+
handshakeCalculator.calculateHandshake(16));
|
|
72
80
|
}
|
|
73
81
|
|
|
74
82
|
@Ignore
|
|
@@ -76,7 +84,7 @@ public final class HandshakeCalculatorTest {
|
|
|
76
84
|
public void testInputThatYieldsAllActions() {
|
|
77
85
|
assertEquals(
|
|
78
86
|
asList(Signal.WINK, Signal.DOUBLE_BLINK, Signal.CLOSE_YOUR_EYES, Signal.JUMP),
|
|
79
|
-
|
|
87
|
+
handshakeCalculator.calculateHandshake(15));
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
@Ignore
|
|
@@ -84,7 +92,7 @@ public final class HandshakeCalculatorTest {
|
|
|
84
92
|
public void testInputThatYieldsAllActionsReversed() {
|
|
85
93
|
assertEquals(
|
|
86
94
|
asList(Signal.JUMP, Signal.CLOSE_YOUR_EYES, Signal.DOUBLE_BLINK, Signal.WINK),
|
|
87
|
-
|
|
95
|
+
handshakeCalculator.calculateHandshake(31));
|
|
88
96
|
}
|
|
89
97
|
|
|
90
98
|
@Ignore
|
|
@@ -92,7 +100,7 @@ public final class HandshakeCalculatorTest {
|
|
|
92
100
|
public void testThatInput0YieldsNoActions() {
|
|
93
101
|
assertEquals(
|
|
94
102
|
emptyList(),
|
|
95
|
-
|
|
103
|
+
handshakeCalculator.calculateHandshake(0));
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
@Ignore
|
|
@@ -100,7 +108,7 @@ public final class HandshakeCalculatorTest {
|
|
|
100
108
|
public void testThatInputWithLower5BitsNotSetYieldsNoActions() {
|
|
101
109
|
assertEquals(
|
|
102
110
|
emptyList(),
|
|
103
|
-
|
|
111
|
+
handshakeCalculator.calculateHandshake(32));
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
}
|