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.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/common/CONTRIBUTING.md +4 -1
  3. data/common/README.md +52 -0
  4. data/lib/trackler/version.rb +1 -1
  5. data/tracks/ecmascript/config.json +7 -0
  6. data/tracks/ecmascript/exercises/perfect-numbers/example.js +68 -0
  7. data/tracks/ecmascript/exercises/perfect-numbers/gulpfile.js +89 -0
  8. data/tracks/ecmascript/exercises/perfect-numbers/package.json +28 -0
  9. data/tracks/ecmascript/exercises/perfect-numbers/perfect-numbers.spec.js +75 -0
  10. data/tracks/erlang/exercises/accumulate/src/accumulate.app.src +1 -1
  11. data/tracks/erlang/exercises/all-your-base/src/all_your_base.app.src +1 -1
  12. data/tracks/erlang/exercises/allergies/src/allergies.app.src +1 -1
  13. data/tracks/erlang/exercises/anagram/src/anagram.app.src +1 -1
  14. data/tracks/erlang/exercises/atbash-cipher/src/atbash_cipher.app.src +1 -1
  15. data/tracks/erlang/exercises/bank-account/src/bank_account.app.src +1 -1
  16. data/tracks/erlang/exercises/beer-song/src/beer_song.app.src +1 -1
  17. data/tracks/erlang/exercises/bob/src/bob.app.src +1 -1
  18. data/tracks/erlang/exercises/circular-buffer/src/circular_buffer.app.src +1 -1
  19. data/tracks/erlang/exercises/clock/src/clock.app.src +1 -1
  20. data/tracks/erlang/exercises/difference-of-squares/src/difference_of_squares.app.src +1 -1
  21. data/tracks/erlang/exercises/etl/src/etl.app.src +1 -1
  22. data/tracks/erlang/exercises/gigasecond/src/gigasecond.app.src +1 -1
  23. data/tracks/erlang/exercises/grade-school/src/grade_school.app.src +1 -1
  24. data/tracks/erlang/exercises/grains/src/grains.app.src +1 -1
  25. data/tracks/erlang/exercises/hamming/src/hamming.app.src +1 -1
  26. data/tracks/erlang/exercises/hello-world/src/hello_world.app.src +1 -1
  27. data/tracks/erlang/exercises/largest-series-product/src/largest_series_product.app.src +1 -1
  28. data/tracks/erlang/exercises/leap/src/leap.app.src +1 -1
  29. data/tracks/erlang/exercises/luhn/src/luhn.app.src +1 -1
  30. data/tracks/erlang/exercises/meetup/src/meetup.app.src +1 -1
  31. data/tracks/erlang/exercises/nucleotide-count/src/nucleotide_count.app.src +1 -1
  32. data/tracks/erlang/exercises/parallel-letter-frequency/src/parallel_letter_frequency.app.src +1 -1
  33. data/tracks/erlang/exercises/phone-number/src/phone_number.app.src +1 -1
  34. data/tracks/erlang/exercises/rna-transcription/src/rna_transcription.app.src +1 -1
  35. data/tracks/erlang/exercises/robot-simulator/src/robot_simulator.app.src +1 -1
  36. data/tracks/erlang/exercises/roman-numerals/src/roman_numerals.app.src +1 -1
  37. data/tracks/erlang/exercises/rotational-cipher/src/rotational_cipher.app.src +1 -1
  38. data/tracks/erlang/exercises/scrabble-score/src/scrabble_score.app.src +1 -1
  39. data/tracks/erlang/exercises/series/src/series.app.src +1 -1
  40. data/tracks/erlang/exercises/space-age/src/space_age.app.src +1 -1
  41. data/tracks/erlang/exercises/strain/src/strain.app.src +1 -1
  42. data/tracks/erlang/exercises/sum-of-multiples/src/sum_of_multiples.app.src +1 -1
  43. data/tracks/erlang/exercises/triangle/src/triangle.app.src +1 -1
  44. data/tracks/erlang/exercises/word-count/src/word_count.app.src +1 -1
  45. data/tracks/erlang/exercises/zipper/src/zipper.app.src +1 -1
  46. data/tracks/go/exercises/hello-world/hello_world.go +10 -1
  47. data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/package.yaml +1 -0
  48. data/tracks/haskell/exercises/simple-linked-list/examples/success-standard/src/LinkedList.hs +1 -0
  49. data/tracks/haskell/exercises/simple-linked-list/package.yaml +1 -0
  50. data/tracks/haskell/exercises/simple-linked-list/src/LinkedList.hs +1 -1
  51. data/tracks/haskell/exercises/simple-linked-list/test/Tests.hs +37 -1
  52. data/tracks/java/exercises/diamond/src/test/java/DiamondPrinterTest.java +13 -6
  53. data/tracks/java/exercises/secret-handshake/src/test/java/HandshakeCalculatorTest.java +21 -13
  54. data/tracks/objective-c/exercises/atbash-cipher/AtbashCipherExample.m +1 -1
  55. data/tracks/objective-c/exercises/beer-song/BeerSongExample.m +1 -1
  56. data/tracks/objective-c/exercises/beer-song/BeerSongTest.m +4 -4
  57. data/tracks/objective-c/exercises/binary-search/BinarySearchExample.m +1 -1
  58. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.h +2 -1
  59. data/tracks/objective-c/exercises/flatten-array/FlattenArrayExample.m +12 -25
  60. data/tracks/objective-c/exercises/flatten-array/FlattenArrayTest.m +32 -80
  61. data/tracks/objective-c/exercises/sublist/SublistTest.m +47 -70
  62. data/tracks/perl6/exercises/allergies/Allergies.pm6 +1 -0
  63. data/tracks/perl6/exercises/allergies/Example.pm +3 -1
  64. data/tracks/perl6/exercises/allergies/allergies.t +187 -137
  65. data/tracks/perl6/exercises/anagram/Anagram.pm6 +1 -0
  66. data/tracks/perl6/exercises/anagram/Example.pm +15 -15
  67. data/tracks/perl6/exercises/anagram/anagram.t +164 -15
  68. data/tracks/perl6/exercises/atbash-cipher/AtbashCipher.pm6 +1 -0
  69. data/tracks/perl6/exercises/atbash-cipher/Example.pm +2 -0
  70. data/tracks/perl6/exercises/atbash-cipher/atbash-cipher.t +109 -86
  71. data/tracks/perl6/exercises/grains/Example.pm +10 -9
  72. data/tracks/perl6/exercises/grains/Grains.pm6 +1 -0
  73. data/tracks/perl6/exercises/grains/grains.t +126 -18
  74. data/tracks/perl6/exercises/leap/Example.pm +9 -9
  75. data/tracks/perl6/exercises/leap/Leap.pm6 +4 -0
  76. data/tracks/perl6/exercises/leap/leap.t +61 -17
  77. data/tracks/perl6/exercises/phone-number/Example.pm +4 -28
  78. data/tracks/perl6/exercises/phone-number/PhoneNumber.pm6 +4 -0
  79. data/tracks/perl6/exercises/phone-number/phone-number.t +102 -65
  80. data/tracks/perl6/exercises/raindrops/Example.pm +10 -8
  81. data/tracks/perl6/exercises/raindrops/Raindrops.pm6 +4 -0
  82. data/tracks/perl6/exercises/raindrops/raindrops.t +153 -20
  83. data/tracks/perl6/exercises/rna-transcription/Example.pm +5 -7
  84. data/tracks/perl6/exercises/rna-transcription/RNA.pm6 +4 -0
  85. data/tracks/perl6/exercises/rna-transcription/rna-transcription.t +107 -11
  86. data/tracks/perl6/exercises/scrabble-score/Example.pm +14 -19
  87. data/tracks/perl6/exercises/scrabble-score/Scrabble.pm6 +4 -0
  88. data/tracks/perl6/exercises/scrabble-score/scrabble-score.t +106 -15
  89. data/tracks/perl6/exercises/space-age/Example.pm +29 -13
  90. data/tracks/perl6/exercises/space-age/SpaceAge.pm6 +22 -0
  91. data/tracks/perl6/exercises/space-age/space-age.t +90 -52
  92. data/tracks/perl6/exercises/word-count/Example.pm +4 -8
  93. data/tracks/perl6/exercises/word-count/WordCount.pm6 +4 -0
  94. data/tracks/perl6/exercises/word-count/word-count.t +149 -16
  95. data/tracks/perl6/exercises/wordy/Example.pm +13 -13
  96. data/tracks/perl6/exercises/wordy/Wordy.pm6 +4 -0
  97. data/tracks/perl6/exercises/wordy/wordy.t +140 -97
  98. data/tracks/purescript/config.json +7 -0
  99. data/tracks/purescript/exercises/atbash-cipher/bower.json +18 -0
  100. data/tracks/purescript/exercises/atbash-cipher/examples/src/AtbashCipher.purs +41 -0
  101. data/tracks/purescript/exercises/atbash-cipher/src/AtbashCipher.purs +4 -0
  102. data/tracks/purescript/exercises/atbash-cipher/test/Main.purs +64 -0
  103. data/tracks/python/exercises/run-length-encoding/run_length_encoding_test.py +2 -0
  104. data/tracks/swift/exercises/grade-school/Tests/GradeSchoolTests/GradeSchoolTests.swift +1 -1
  105. metadata +22 -2
@@ -1,6 +1,6 @@
1
1
  {application, circular_buffer,
2
2
  [{description, "exercism.io - circular-buffer"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, clock,
2
2
  [{description, "exercism.io - clock"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, difference_of_squares,
2
2
  [{description, "exercism.io - difference-of-squares"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, etl,
2
2
  [{description, "exercism.io - etl"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, gigasecond,
2
2
  [{description, "exercism.io - gigasecond"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, grade_school,
2
2
  [{description, "exercism.io - grade-school"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, grains,
2
2
  [{description, "exercism.io - grains"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, hamming,
2
2
  [{description, "exercism.io - hamming"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, hello_world,
2
2
  [{description, "exercism.io - hello-world"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, largest_series_product,
2
2
  [{description, "exercism.io - largest-series-product"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, leap,
2
2
  [{description, "exercism.io - leap"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, luhn,
2
2
  [{description, "exercism.io - luhn"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, meetup,
2
2
  [{description, "exercism.io - meetup"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, nucleotide_count,
2
2
  [{description, "exercism.io - nucleotide-count"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, parallel_letter_frequency,
2
2
  [{description, "exercism.io - parallel-letter-frequency"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, phone_number,
2
2
  [{description, "exercism.io - phone-number"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, rna_transcription,
2
2
  [{description, "exercism.io - rna-transcription"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, robot_simulator,
2
2
  [{description, "exercism.io - robot-simulator"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, roman_numerals,
2
2
  [{description, "exercism.io - roman-numerals"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, rotational_cipher,
2
2
  [{description, "exercism.io - rotational-cipher"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, scrabble_score,
2
2
  [{description, "exercism.io - scrabble-score"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, series,
2
2
  [{description, "exercism.io - series"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, space_age,
2
2
  [{description, "exercism.io - space-age"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, strain,
2
2
  [{description, "exercism.io - strain"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, sum_of_multiples,
2
2
  [{description, "exercism.io - sum-of-multiples"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, triangle,
2
2
  [{description, "exercism.io - triangle"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, word_count,
2
2
  [{description, "exercism.io - word-count"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -1,6 +1,6 @@
1
1
  {application, zipper,
2
2
  [{description, "exercism.io - zipper"},
3
- {vsn, "git"},
3
+ {vsn, "0.0.1"},
4
4
  {modules, []},
5
5
  {registered, []},
6
6
  {applications, [kernel,
@@ -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 needs a comment documenting it as package does.
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
 
@@ -14,3 +14,4 @@ tests:
14
14
  dependencies:
15
15
  - simple-linked-list
16
16
  - hspec
17
+ - QuickCheck
@@ -5,6 +5,7 @@ module LinkedList ( LinkedList
5
5
  data LinkedList a = Nil
6
6
  | Cons { datum :: a
7
7
  , next :: LinkedList a }
8
+ deriving (Eq, Show)
8
9
 
9
10
  new :: a -> LinkedList a -> LinkedList a
10
11
  new = Cons
@@ -17,3 +17,4 @@ tests:
17
17
  dependencies:
18
18
  - simple-linked-list
19
19
  - hspec
20
+ - QuickCheck
@@ -10,7 +10,7 @@ module LinkedList
10
10
  , toList
11
11
  ) where
12
12
 
13
- data LinkedList a = Dummy
13
+ data LinkedList a = Dummy deriving (Eq, Show)
14
14
 
15
15
  datum :: LinkedList a -> a
16
16
  datum linkedList = error "You need to implement this function."
@@ -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 "reverseList" $ do
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 = new DiamondPrinter().printToList('A');
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 = new DiamondPrinter().printToList('B');
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 = new DiamondPrinter().printToList('C');
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 = new DiamondPrinter().printToList('E');
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 = new DiamondPrinter().printToList('Z');
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
- new HandshakeCalculator().calculateHandshake(1));
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
- new HandshakeCalculator().calculateHandshake(2));
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
- new HandshakeCalculator().calculateHandshake(4));
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
- new HandshakeCalculator().calculateHandshake(8));
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
- new HandshakeCalculator().calculateHandshake(3));
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
- new HandshakeCalculator().calculateHandshake(19));
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
- new HandshakeCalculator().calculateHandshake(24));
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
- new HandshakeCalculator().calculateHandshake(16));
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
- new HandshakeCalculator().calculateHandshake(15));
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
- new HandshakeCalculator().calculateHandshake(31));
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
- new HandshakeCalculator().calculateHandshake(0));
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
- new HandshakeCalculator().calculateHandshake(32));
111
+ handshakeCalculator.calculateHandshake(32));
104
112
  }
105
113
 
106
114
  }