spec :: Spec
spec =
  describe "Chapter Seven" $ do
    describe "channel" $ do
      it "chop8 equals mychop8" $ property $ \l -> chop8 l == mychop8 l
      it "mymap" $ mymap (* 2) [1, 2, 3] `shouldBe` ([2, 4, 6] :: [Int])
      it "myiterate" $
        take 3 (myiterate (* 2) 1) `shouldBe` ([1, 2, 4] :: [Int])
      it "encode 'a'" $
        encodeWithParity "a" `shouldBe` [1, 1, 0, 0, 0, 0, 1, 1, 0]
      it "decode 'a'" $
        decodeWithParity [1, 1, 0, 0, 0, 0, 1, 1, 0] `shouldBe` "a"
      it "transmit is idempotent" $ property $ \l -> transmit l == l
      it "transmitWithParity is idempotent" $
        property $ \l -> transmitWithParity l == l
      -- can't get hspec to catch these errors correctly
      -- it "Parity error" $ evaluate (decodeWithParity [0, 1, 0, 0, 0, 0, 1, 1, 0]) `shouldThrow` anyErrorCall
      -- it "faultyTransmit" $ evaluate (faultyTransmit "Hi") `shouldThrow` anyErrorCall
    describe "luhn" $ do
      it "altMap" $
        altMap (+ 10) (+ 100) [0, 1, 2, 3, 4] `shouldBe`
        ([10, 101, 12, 103, 14] :: [Int])
      it "luhn true" $ anyLuhn [4, 2, 3, 4] `shouldBe` True
      it "luhn false" $ anyLuhn [1, 2, 3, 4] `shouldBe` False
spec :: Spec
spec =
  describe "Chapter Seven" $ do
    describe "channel" $ do
      it "chop8 equals mychop8" $ property $ \l -> chop8 l == mychop8 l
      it "mymap" $ mymap (* 2) [1, 2, 3] `shouldBe` ([2, 4, 6] :: [Int])
      it "myiterate" $
        take 3 (myiterate (* 2) 1) `shouldBe` ([1, 2, 4] :: [Int])
      it "encode 'a'" $
        encodeWithParity "a" `shouldBe` [1, 1, 0, 0, 0, 0, 1, 1, 0]
      it "decode 'a'" $
        decodeWithParity [1, 1, 0, 0, 0, 0, 1, 1, 0] `shouldBe` "a"
      it "transmit is idempotent" $ property $ \l -> transmit l == l
      it "transmitWithParity is idempotent" $
        property $ \l -> transmitWithParity l == l
      -- can't get hspec to catch these errors correctly
      -- it "Parity error" $ evaluate (decodeWithParity [0, 1, 0, 0, 0, 0, 1, 1, 0]) `shouldThrow` anyErrorCall
      -- it "faultyTransmit" $ evaluate (faultyTransmit "Hi") `shouldThrow` anyErrorCall
    describe "luhn" $ do
      it "altMap" $
        altMap (+ 10) (+ 100) [0, 1, 2, 3, 4] `shouldBe`
        ([10, 101, 12, 103, 14] :: [Int])
      it "luhn true" $ anyLuhn [4, 2, 3, 4] `shouldBe` True
      it "luhn false" $ anyLuhn [1, 2, 3, 4] `shouldBe` False
spec =
  describe "Chapter Seven" $ do
    describe "channel" $ do
      it "chop8 equals mychop8" $ property $ \l -> chop8 l == mychop8 l
      it "mymap" $ mymap (* 2) [1, 2, 3] `shouldBe` ([2, 4, 6] :: [Int])
      it "myiterate" $
        take 3 (myiterate (* 2) 1) `shouldBe` ([1, 2, 4] :: [Int])
      it "encode 'a'" $
        encodeWithParity "a" `shouldBe` [1, 1, 0, 0, 0, 0, 1, 1, 0]
      it "decode 'a'" $
        decodeWithParity [1, 1, 0, 0, 0, 0, 1, 1, 0] `shouldBe` "a"
      it "transmit is idempotent" $ property $ \l -> transmit l == l
      it "transmitWithParity is idempotent" $
        property $ \l -> transmitWithParity l == l
      -- can't get hspec to catch these errors correctly
      -- it "Parity error" $ evaluate (decodeWithParity [0, 1, 0, 0, 0, 0, 1, 1, 0]) `shouldThrow` anyErrorCall
      -- it "faultyTransmit" $ evaluate (faultyTransmit "Hi") `shouldThrow` anyErrorCall
    describe "luhn" $ do
      it "altMap" $
        altMap (+ 10) (+ 100) [0, 1, 2, 3, 4] `shouldBe`
        ([10, 101, 12, 103, 14] :: [Int])
      it "luhn true" $ anyLuhn [4, 2, 3, 4] `shouldBe` True
      it "luhn false" $ anyLuhn [1, 2, 3, 4] `shouldBe` False