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.

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