You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Day6Spec.hs 1.3KB

1234567891011121314151617181920212223242526272829303132
  1. module Day6Spec (spec) where
  2. import Test.Hspec
  3. import Day6
  4. import qualified Data.Sequence as S
  5. spec :: Spec
  6. spec =
  7. describe "Day6" $ do
  8. describe "Part1" $ do
  9. it "finds the marker just after the beginning" $ do
  10. findEnd "aabcd" `shouldBe` Just 5
  11. it "finds the marker in the beginning" $ do
  12. findEnd "abcd" `shouldBe` Just 4
  13. findEnd "aabcd" `shouldBe` Just 5
  14. it "finds nothing if nothing is there" $ do
  15. findEnd "abc" `shouldBe` Nothing
  16. findEnd "abcb" `shouldBe` Nothing
  17. findEnd "abcabcb" `shouldBe` Nothing
  18. it "finds a marker" $ do
  19. findEnd "mjqjpqmgbljsphdztnvjfqwrcgsmlb"`shouldBe` Just 7
  20. findEnd "bvwbjplbgvbhsrlpgdmjqwftvncz" `shouldBe` Just 5
  21. findEnd "nppdvjthqldpwncqszvftbrmjlhg" `shouldBe` Just 6
  22. findEnd "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg" `shouldBe` Just 10
  23. findEnd "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw" `shouldBe` Just 11
  24. describe "Part 2" $ do
  25. it "finds start of message marker" $ do
  26. findStart "mjqjpqmgbljsphdztnvjfqwrcgsmlb"`shouldBe` Just 19
  27. findStart "bvwbjplbgvbhsrlpgdmjqwftvncz" `shouldBe` Just 23
  28. findStart "nppdvjthqldpwncqszvftbrmjlhg" `shouldBe` Just 23
  29. findStart "nznrnfrfntjfmvfwmzdfjlvtqnbhcprsg" `shouldBe` Just 29
  30. findStart "zcfzfwzzqfrljwzlrfnpqdbhtmscgvjw" `shouldBe` Just 26