trackler 2.2.1.84 → 2.2.1.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/atbash-cipher/canonical-data.json +38 -14
  4. data/problem-specifications/exercises/bracket-push/canonical-data.json +44 -16
  5. data/problem-specifications/exercises/change/canonical-data.json +46 -24
  6. data/problem-specifications/exercises/collatz-conjecture/canonical-data.json +20 -8
  7. data/problem-specifications/exercises/connect/canonical-data.json +87 -67
  8. data/problem-specifications/exercises/crypto-square/canonical-data.json +23 -9
  9. data/problem-specifications/exercises/diamond/canonical-data.json +16 -6
  10. data/problem-specifications/exercises/difference-of-squares/canonical-data.json +29 -11
  11. data/problem-specifications/exercises/dominoes/canonical-data.json +37 -13
  12. data/problem-specifications/exercises/flatten-array/canonical-data.json +19 -7
  13. data/problem-specifications/exercises/meetup/canonical-data.json +667 -477
  14. data/tracks/haskell/config.json +9 -0
  15. data/tracks/haskell/docs/LEARNING.md +3 -3
  16. data/tracks/haskell/exercises/food-chain/examples/success-standard/src/FoodChain.hs +1 -1
  17. data/tracks/haskell/exercises/forth/examples/success-standard/src/Forth.hs +2 -2
  18. data/tracks/haskell/exercises/parallel-letter-frequency/examples/success-standard/src/Frequency.hs +1 -1
  19. data/tracks/haskell/exercises/sgf-parsing/examples/success-standard/src/Sgf.hs +1 -1
  20. data/tracks/haskell/exercises/twelve-days/README.md +89 -0
  21. data/tracks/haskell/exercises/twelve-days/examples/success-standard/package.yaml +16 -0
  22. data/tracks/haskell/exercises/twelve-days/examples/success-standard/src/TwelveDays.hs +36 -0
  23. data/tracks/haskell/exercises/twelve-days/package.yaml +20 -0
  24. data/tracks/haskell/exercises/twelve-days/src/TwelveDays.hs +4 -0
  25. data/tracks/haskell/exercises/twelve-days/stack.yaml +1 -0
  26. data/tracks/haskell/exercises/twelve-days/test/Tests.hs +146 -0
  27. data/tracks/haskell/exercises/zipper/examples/success-standard/src/Zipper.hs +3 -3
  28. data/tracks/java/exercises/allergies/.meta/version +2 -0
  29. data/tracks/java/exercises/allergies/src/test/java/AllergiesTest.java +10 -65
  30. data/tracks/java/exercises/anagram/.meta/version +1 -0
  31. data/tracks/java/exercises/anagram/src/test/java/AnagramTest.java +36 -35
  32. data/tracks/java/exercises/atbash-cipher/.meta/version +1 -0
  33. data/tracks/java/exercises/atbash-cipher/src/test/java/AtbashTest.java +3 -2
  34. data/tracks/java/exercises/bob/.meta/src/reference/java/Bob.java +3 -0
  35. data/tracks/java/exercises/bob/.meta/version +1 -0
  36. data/tracks/java/exercises/bob/src/test/java/BobTest.java +79 -15
  37. data/tracks/java/exercises/crypto-square/.meta/src/reference/java/CryptoSquare.java +62 -0
  38. data/tracks/java/exercises/crypto-square/.meta/version +1 -0
  39. data/tracks/java/exercises/crypto-square/src/test/java/CryptoSquareTest.java +28 -101
  40. data/tracks/java/exercises/custom-set/.meta/version +1 -1
  41. data/tracks/java/exercises/custom-set/src/test/java/CustomSetTest.java +8 -0
  42. data/tracks/java/exercises/forth/.meta/version +1 -1
  43. data/tracks/java/exercises/forth/src/test/java/ForthEvaluatorTest.java +52 -12
  44. data/tracks/java/exercises/pascals-triangle/.meta/version +1 -1
  45. data/tracks/java/exercises/pascals-triangle/src/test/java/PascalsTriangleGeneratorTest.java +48 -0
  46. data/tracks/java/exercises/prime-factors/.meta/version +1 -0
  47. data/tracks/java/exercises/prime-factors/src/test/java/PrimeFactorsCalculatorTest.java +2 -6
  48. data/tracks/java/exercises/protein-translation/.meta/version +1 -1
  49. data/tracks/java/exercises/roman-numerals/.meta/version +1 -0
  50. data/tracks/java/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java +0 -1
  51. data/tracks/java/exercises/rotational-cipher/.meta/version +1 -0
  52. data/tracks/java/exercises/rotational-cipher/src/test/java/RotationalCipherTest.java +7 -7
  53. data/tracks/javascript/.eslintignore +0 -1
  54. data/tracks/javascript/README.md +1 -1
  55. data/tracks/javascript/exercises/clock/example.js +8 -11
  56. metadata +18 -3
  57. data/tracks/java/exercises/crypto-square/.meta/src/reference/java/Crypto.java +0 -74
@@ -266,6 +266,15 @@
266
266
  "Maybe"
267
267
  ]
268
268
  },
269
+ {
270
+ "uuid": "d1dc946d-a142-42ed-abec-e53605635c0d",
271
+ "slug": "twelve-days",
272
+ "core": false,
273
+ "unlocked_by": null,
274
+ "difficulty": 3,
275
+ "topics": [
276
+ ]
277
+ },
269
278
  {
270
279
  "uuid": "382e4fbd-99d6-400b-962c-ebb4a411bcea",
271
280
  "slug": "beer-song",
@@ -1,12 +1,12 @@
1
- ## Learning Haskell
1
+ ## Learning Haskell
2
2
 
3
3
  Haskell is a purely functional language, which is a paradigm fundamentally different than the more
4
4
  commonly taught [object oriented approach](https://en.wikipedia.org/wiki/Object-oriented_programming). Because of this,
5
5
  learning Haskell can feel different than simply picking up another language.
6
6
 
7
7
  Fortunately there are numerous resources which presume some programming knowledge to begin with, such
8
- as
9
- - the popular [Learn You a Haskell For Great Good!](http://learnyouahaskell.com/)
8
+ as
9
+ - the popular [Learn You a Haskell For Great Good!](http://learnyouahaskell.com/)
10
10
  - University of Glasgow's [Functional Programming in Haskell](https://www.futurelearn.com/courses/functional-programming-haskell) course
11
11
  - FP Complete's [School of Haskell](https://www.schoolofhaskell.com/)
12
12
  - and the [Happy Learn Haskell Tutorial](http://www.happylearnhaskelltutorial.com/).
@@ -43,4 +43,4 @@ comment animal = case animal of
43
43
  Dog -> "What a hog, to swallow a dog!"
44
44
  Goat -> "Just opened her throat and swallowed a goat!"
45
45
  Cow -> "I don't know how she swallowed a cow!"
46
- Horse -> "She's dead, of course!"
46
+ Horse -> "She's dead, of course!"
@@ -17,10 +17,10 @@ import Control.Arrow (first)
17
17
 
18
18
  type Value = Int
19
19
  type FWord = Text
20
- data Term
20
+ data Term
21
21
  = StartDefinition
22
22
  | EndDefinition
23
- | V Value
23
+ | V Value
24
24
  | W FWord
25
25
  deriving (Show, Ord, Eq)
26
26
 
@@ -11,7 +11,7 @@ import qualified Data.Text as T
11
11
  -- | Compute the frequency of letters in the text using the given number of
12
12
  -- parallel workers.
13
13
  frequency :: Int -> [Text] -> Map Char Int
14
- frequency workers texts =
14
+ frequency workers texts =
15
15
  let chunkSize = ceiling (length texts % workers)
16
16
  freqs = map countLetters texts `using` parListChunk chunkSize rdeepseq
17
17
  in Map.unionsWith (+) freqs
@@ -38,7 +38,7 @@ prop :: Parser (Text, [Text])
38
38
  prop = (,) <$> (T.pack <$> many1 (satisfy isUpper)) <*> many1 val
39
39
 
40
40
  -- | Parse a value, complete with brackets.
41
- --
41
+ --
42
42
  -- This is a bit tricky as there are escape sequences to take into account.
43
43
  --
44
44
  -- We'll use a simple folder with one bit of state: whether the last
@@ -0,0 +1,89 @@
1
+ # Twelve Days
2
+
3
+ Output the lyrics to 'The Twelve Days of Christmas'.
4
+
5
+ ```text
6
+ On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.
7
+
8
+ On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.
9
+
10
+ On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
11
+
12
+ On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
13
+
14
+ On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
15
+
16
+ On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
17
+
18
+ On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
19
+
20
+ On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
21
+
22
+ On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
23
+
24
+ On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
25
+
26
+ On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
27
+
28
+ On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.
29
+ ```
30
+
31
+
32
+ ## Getting Started
33
+
34
+ For installation and learning resources, refer to the
35
+ [exercism help page](http://exercism.io/languages/haskell).
36
+
37
+ ## Running the tests
38
+
39
+ To run the test suite, execute the following command:
40
+
41
+ ```bash
42
+ stack test
43
+ ```
44
+
45
+ #### If you get an error message like this...
46
+
47
+ ```
48
+ No .cabal file found in directory
49
+ ```
50
+
51
+ You are probably running an old stack version and need
52
+ to upgrade it.
53
+
54
+ #### Otherwise, if you get an error message like this...
55
+
56
+ ```
57
+ No compiler found, expected minor version match with...
58
+ Try running "stack setup" to install the correct GHC...
59
+ ```
60
+
61
+ Just do as it says and it will download and install
62
+ the correct compiler version:
63
+
64
+ ```bash
65
+ stack setup
66
+ ```
67
+
68
+ ## Running *GHCi*
69
+
70
+ If you want to play with your solution in GHCi, just run the command:
71
+
72
+ ```bash
73
+ stack ghci
74
+ ```
75
+
76
+ ## Feedback, Issues, Pull Requests
77
+
78
+ The [exercism/haskell](https://github.com/exercism/haskell) repository on
79
+ GitHub is the home for all of the Haskell exercises.
80
+
81
+ If you have feedback about an exercise, or want to help implementing a new
82
+ one, head over there and create an issue. We'll do our best to help you!
83
+
84
+ ## Source
85
+
86
+ Wikipedia [http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song)](http://en.wikipedia.org/wiki/The_Twelve_Days_of_Christmas_(song))
87
+
88
+ ## Submitting Incomplete Solutions
89
+ It's possible to submit an incomplete solution so you can see how others have completed the exercise.
@@ -0,0 +1,16 @@
1
+ name: twelve-days
2
+
3
+ dependencies:
4
+ - base
5
+
6
+ library:
7
+ exposed-modules: TwelveDays
8
+ source-dirs: src
9
+
10
+ tests:
11
+ test:
12
+ main: Tests.hs
13
+ source-dirs: test
14
+ dependencies:
15
+ - twelve-days
16
+ - hspec
@@ -0,0 +1,36 @@
1
+ module TwelveDays (recite) where
2
+
3
+ recite :: Int -> Int -> [String]
4
+ recite start stop
5
+ | start <= stop = lyrics start : recite (start + 1) stop
6
+ | otherwise = []
7
+
8
+ lyrics :: Int -> String
9
+ lyrics days =
10
+ beginning ++ end days
11
+ where
12
+ beginning =
13
+ let (day, _) = verse days
14
+ in "On the " ++ day ++ " day of Christmas my true love gave to me"
15
+ end days'
16
+ | days < 13 && days' > 0 = let (_, gift) = verse days'
17
+ in prefix days' ++ gift ++ end (days' - 1)
18
+ | otherwise = "."
19
+ where
20
+ prefix 1 = if days > 1 then ", and " else ", "
21
+ prefix _ = ", "
22
+
23
+ verse :: Int -> (String, String)
24
+ verse 12 = ("twelfth", "twelve Drummers Drumming")
25
+ verse 11 = ("eleventh", "eleven Pipers Piping")
26
+ verse 10 = ("tenth", "ten Lords-a-Leaping")
27
+ verse 9 = ("ninth", "nine Ladies Dancing")
28
+ verse 8 = ("eighth", "eight Maids-a-Milking")
29
+ verse 7 = ("seventh", "seven Swans-a-Swimming")
30
+ verse 6 = ("sixth", "six Geese-a-Laying")
31
+ verse 5 = ("fifth", "five Gold Rings")
32
+ verse 4 = ("fourth", "four Calling Birds")
33
+ verse 3 = ("third", "three French Hens")
34
+ verse 2 = ("second", "two Turtle Doves")
35
+ verse 1 = ("first", "a Partridge in a Pear Tree")
36
+ verse _ = ("", "")
@@ -0,0 +1,20 @@
1
+ name: twelve-days
2
+ version: 1.0.0.1
3
+
4
+ dependencies:
5
+ - base
6
+
7
+ library:
8
+ exposed-modules: TwelveDays
9
+ source-dirs: src
10
+ dependencies:
11
+ # - foo # List here the packages you
12
+ # - bar # want to use in your solution.
13
+
14
+ tests:
15
+ test:
16
+ main: Tests.hs
17
+ source-dirs: test
18
+ dependencies:
19
+ - twelve-days
20
+ - hspec
@@ -0,0 +1,4 @@
1
+ module TwelveDays (recite) where
2
+
3
+ recite :: Int -> Int -> [String]
4
+ recite start stop = error "You need to implement this function."
@@ -0,0 +1 @@
1
+ resolver: lts-9.11
@@ -0,0 +1,146 @@
1
+ {-# LANGUAGE RecordWildCards #-}
2
+
3
+ import Data.Foldable (for_)
4
+ import Test.Hspec (Spec, describe, it, shouldBe)
5
+ import Test.Hspec.Runner (configFastFail, defaultConfig, hspecWith)
6
+
7
+ import TwelveDays (recite)
8
+
9
+ main :: IO ()
10
+ main = hspecWith defaultConfig {configFastFail = True} specs
11
+
12
+ specs :: Spec
13
+ specs = describe "responseFor" $ for_ cases test
14
+ where
15
+ test Case{..} = it description assertion
16
+ where
17
+ assertion = recite start stop `shouldBe` expected
18
+
19
+ data Case = Case { description :: String
20
+ , start :: Int
21
+ , stop :: Int
22
+ , expected :: [String]
23
+ }
24
+
25
+ cases :: [Case]
26
+ cases = [ Case { description = "first day a partridge in a pear tree"
27
+ , start = 1
28
+ , stop = 1
29
+ , expected = [
30
+ "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree."
31
+ ]
32
+ }
33
+ , Case { description = "second day two turtle doves"
34
+ , start = 2
35
+ , stop = 2
36
+ , expected = [
37
+ "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree."
38
+ ]
39
+ }
40
+ , Case { description = "third day three french hens"
41
+ , start = 3
42
+ , stop = 3
43
+ , expected = [
44
+ "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
45
+ ]
46
+ }
47
+ , Case { description = "fourth day four calling birds"
48
+ , start = 4
49
+ , stop = 4
50
+ , expected = [
51
+ "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
52
+ ]
53
+ }
54
+ , Case { description = "fifth day five gold rings"
55
+ , start = 5
56
+ , stop = 5
57
+ , expected = [
58
+ "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
59
+ ]
60
+ }
61
+ , Case { description = "sixth day six geese-a-laying"
62
+ , start = 6
63
+ , stop = 6
64
+ , expected = [
65
+ "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
66
+ ]
67
+ }
68
+ , Case { description = "seventh day seven swans-a-swimming"
69
+ , start = 7
70
+ , stop = 7
71
+ , expected = [
72
+ "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
73
+ ]
74
+ }
75
+ , Case { description = "eighth day eight maids-a-milking"
76
+ , start = 8
77
+ , stop = 8
78
+ , expected = [
79
+ "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
80
+ ]
81
+ }
82
+ , Case { description = "ninth day nine ladies dancing"
83
+ , start = 9
84
+ , stop = 9
85
+ , expected = [
86
+ "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
87
+ ]
88
+ }
89
+ , Case { description = "tenth day ten lords-a-leaping"
90
+ , start = 10
91
+ , stop = 10
92
+ , expected = [
93
+ "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
94
+ ]
95
+ }
96
+ , Case { description = "eleventh day eleven pipers piping"
97
+ , start = 11
98
+ , stop = 11
99
+ , expected = [
100
+ "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
101
+ ]
102
+ }
103
+ , Case { description = "twelfth day twelve drummers drumming"
104
+ , start = 12
105
+ , stop = 12
106
+ , expected = [
107
+ "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
108
+ ]
109
+ }
110
+ , Case { description = "recites first three verses of the song"
111
+ , start = 1
112
+ , stop = 3
113
+ , expected = [
114
+ "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree."
115
+ , "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree."
116
+ , "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
117
+ ]
118
+ }
119
+ , Case { description = "recites three verses from the middle of the song"
120
+ , start = 4
121
+ , stop = 6
122
+ , expected = [
123
+ "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
124
+ , "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
125
+ , "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
126
+ ]
127
+ }
128
+ , Case { description = "recites the whole song"
129
+ , start = 1
130
+ , stop = 12
131
+ , expected = [
132
+ "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree."
133
+ , "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree."
134
+ , "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
135
+ , "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
136
+ , "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
137
+ , "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
138
+ , "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
139
+ , "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
140
+ , "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
141
+ , "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
142
+ , "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
143
+ , "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree."
144
+ ]
145
+ }
146
+ ]
@@ -16,7 +16,7 @@ module Zipper (
16
16
  ) where
17
17
 
18
18
  -- | A binary tree.
19
- data BinTree a = BT {
19
+ data BinTree a = BT {
20
20
  btValue :: a, -- ^ Value
21
21
  btLeft :: Maybe (BinTree a), -- ^ Left child
22
22
  btRight :: Maybe (BinTree a) -- ^ Right child
@@ -53,7 +53,7 @@ toTree (Z v l r zt) = go (BT v l r) zt
53
53
 
54
54
  -- | Get the value of the focus node.
55
55
  value :: Zipper a -> a
56
- value = zValue
56
+ value = zValue
57
57
 
58
58
  -- | Get the left child of the focus node, if any.
59
59
  left :: Zipper a -> Maybe (Zipper a)
@@ -81,4 +81,4 @@ setLeft t z = z { zLeft = t }
81
81
 
82
82
  -- | Replace a right child tree.
83
83
  setRight :: Maybe (BinTree a) -> Zipper a -> Zipper a
84
- setRight t z = z { zRight = t }
84
+ setRight t z = z { zRight = t }
@@ -6,6 +6,8 @@ import java.util.List;
6
6
  import java.util.Collections;
7
7
 
8
8
  import static org.junit.Assert.assertEquals;
9
+ import static org.junit.Assert.assertTrue;
10
+ import static org.junit.Assert.assertFalse;
9
11
 
10
12
  public class AllergiesTest {
11
13
 
@@ -14,10 +16,9 @@ public class AllergiesTest {
14
16
  public void noAllergiesMeansNotAllergicToAnything() {
15
17
  Allergies allergies = new Allergies(0);
16
18
 
17
- assertEquals(false, allergies.isAllergicTo(Allergen.EGGS));
18
- assertEquals(false, allergies.isAllergicTo(Allergen.PEANUTS));
19
- assertEquals(false, allergies.isAllergicTo(Allergen.STRAWBERRIES));
20
- assertEquals(false, allergies.isAllergicTo(Allergen.CATS));
19
+ assertFalse(allergies.isAllergicTo(Allergen.PEANUTS));
20
+ assertFalse(allergies.isAllergicTo(Allergen.CATS));
21
+ assertFalse(allergies.isAllergicTo(Allergen.STRAWBERRIES));
21
22
  }
22
23
 
23
24
  @Ignore("Remove to run test")
@@ -25,73 +26,17 @@ public class AllergiesTest {
25
26
  public void allergicToEggs() {
26
27
  Allergies allergies = new Allergies(1);
27
28
 
28
- assertEquals(true, allergies.isAllergicTo(Allergen.EGGS));
29
+ assertTrue(allergies.isAllergicTo(Allergen.EGGS));
29
30
  }
30
31
 
31
32
  @Ignore("Remove to run test")
32
33
  @Test
33
- public void allergicToPeanuts() {
34
- Allergies allergies = new Allergies(2);
35
-
36
- assertEquals(true, allergies.isAllergicTo(Allergen.PEANUTS));
37
- }
38
-
39
- @Ignore("Remove to run test")
40
- @Test
41
- public void allergicToShellfish() {
42
- Allergies allergies = new Allergies(4);
43
-
44
- assertEquals(true, allergies.isAllergicTo(Allergen.SHELLFISH));
45
- }
46
-
47
- @Ignore("Remove to run test")
48
- @Test
49
- public void allergicToStrawberries() {
50
- Allergies allergies = new Allergies(8);
51
-
52
- assertEquals(true, allergies.isAllergicTo(Allergen.STRAWBERRIES));
53
- }
54
-
55
- @Ignore("Remove to run test")
56
- @Test
57
- public void allergicToTomatoes() {
58
- Allergies allergies = new Allergies(16);
59
-
60
- assertEquals(true, allergies.isAllergicTo(Allergen.TOMATOES));
61
- }
62
-
63
- @Ignore("Remove to run test")
64
- @Test
65
- public void allergicToChocolate() {
66
- Allergies allergies = new Allergies(32);
67
-
68
- assertEquals(true, allergies.isAllergicTo(Allergen.CHOCOLATE));
69
- }
70
-
71
- @Ignore("Remove to run test")
72
- @Test
73
- public void allergicToPollen() {
74
- Allergies allergies = new Allergies(64);
75
-
76
- assertEquals(true, allergies.isAllergicTo(Allergen.POLLEN));
77
- }
78
-
79
- @Ignore("Remove to run test")
80
- @Test
81
- public void allergicToCats() {
82
- Allergies allergies = new Allergies(128);
83
-
84
- assertEquals(true, allergies.isAllergicTo(Allergen.CATS));
85
- }
86
-
87
- @Ignore("Remove to run test")
88
- @Test
89
- public void isAllergicToEggsInAdditionToOtherStuff() {
34
+ public void allergicToEggsInAdditionToOtherStuff() {
90
35
  Allergies allergies = new Allergies(5);
91
36
 
92
- assertEquals(true, allergies.isAllergicTo(Allergen.EGGS));
93
- assertEquals(true, allergies.isAllergicTo(Allergen.SHELLFISH));
94
- assertEquals(false, allergies.isAllergicTo(Allergen.STRAWBERRIES));
37
+ assertTrue(allergies.isAllergicTo(Allergen.EGGS));
38
+ assertTrue(allergies.isAllergicTo(Allergen.SHELLFISH));
39
+ assertFalse(allergies.isAllergicTo(Allergen.STRAWBERRIES));
95
40
  }
96
41
 
97
42
  @Ignore("Remove to run test")