Day6 with better algorithm
This commit is contained in:
@@ -2,21 +2,21 @@ module Day6Spec (spec) where
|
||||
|
||||
import Test.Hspec
|
||||
import Day6
|
||||
import qualified Data.Sequence as S
|
||||
|
||||
spec :: Spec
|
||||
spec =
|
||||
describe "Day6" $ do
|
||||
describe "Part1" $ do
|
||||
it "finds unique lists" $ do
|
||||
isUnique "abc" `shouldBe` True
|
||||
isUnique "abca" `shouldBe` False
|
||||
isUnique "cabc" `shouldBe` False
|
||||
it "finds nothing if nothing is there" $ do
|
||||
findEnd "abcb" `shouldBe` Nothing
|
||||
findEnd "abcabcb" `shouldBe` Nothing
|
||||
it "finds the marker just after the beginning" $ do
|
||||
findEnd "aabcd" `shouldBe` Just 5
|
||||
it "finds the marker in the beginning" $ do
|
||||
findEnd "abcd" `shouldBe` Just 4
|
||||
findEnd "aabcd" `shouldBe` Just 5
|
||||
it "finds nothing if nothing is there" $ do
|
||||
findEnd "abc" `shouldBe` Nothing
|
||||
findEnd "abcb" `shouldBe` Nothing
|
||||
findEnd "abcabcb" `shouldBe` Nothing
|
||||
it "finds a marker" $ do
|
||||
findEnd "mjqjpqmgbljsphdztnvjfqwrcgsmlb"`shouldBe` Just 7
|
||||
findEnd "bvwbjplbgvbhsrlpgdmjqwftvncz" `shouldBe` Just 5
|
||||
|
||||
Reference in New Issue
Block a user