mirror of
https://codeberg.org/JasterV/aoc2024-haskell.git
synced 2026-04-26 18:10:05 +00:00
16 lines
470 B
Haskell
16 lines
470 B
Haskell
import Control.Exception (evaluate)
|
|
import Test.Hspec
|
|
import Test.QuickCheck
|
|
|
|
main :: IO ()
|
|
main = hspec $ do
|
|
describe "Prelude.head" $ do
|
|
it "returns the first element of a list" $ do
|
|
head [23 ..] `shouldBe` (23 :: Int)
|
|
|
|
it "returns the first element of an *arbitrary* list" $
|
|
property $
|
|
\x xs -> head (x : xs) == (x :: Int)
|
|
|
|
it "throws an exception if used with an empty list" $ do
|
|
evaluate (head []) `shouldThrow` anyException
|