mirror of
https://codeberg.org/JasterV/aoc2024-haskell.git
synced 2026-04-26 18:10:05 +00:00
setup tests!
This commit is contained in:
parent
fd770273f6
commit
d8e1b33810
3 changed files with 22 additions and 2 deletions
|
|
@ -51,7 +51,10 @@ test-suite aoc2024-test
|
||||||
test
|
test
|
||||||
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
|
ghc-options: -Wall -Wcompat -Widentities -Wincomplete-record-updates -Wincomplete-uni-patterns -Wmissing-export-lists -Wmissing-home-modules -Wpartial-fields -Wredundant-constraints -threaded -rtsopts -with-rtsopts=-N
|
||||||
build-depends:
|
build-depends:
|
||||||
aoc2024
|
HUnit >=1.6.2.0 && <1.7
|
||||||
|
, QuickCheck >=2.14.3 && <2.15
|
||||||
|
, aoc2024
|
||||||
, base >=4.7 && <5
|
, base >=4.7 && <5
|
||||||
|
, hspec >=2.0.0
|
||||||
, regex-tdfa >=1.3.2 && <1.4
|
, regex-tdfa >=1.3.2 && <1.4
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
||||||
|
|
@ -47,3 +47,6 @@ tests:
|
||||||
- -with-rtsopts=-N
|
- -with-rtsopts=-N
|
||||||
dependencies:
|
dependencies:
|
||||||
- aoc2024
|
- aoc2024
|
||||||
|
- QuickCheck ^>= 2.14.3
|
||||||
|
- HUnit ^>= 1.6.2.0
|
||||||
|
- hspec >=2.0.0
|
||||||
|
|
|
||||||
16
test/Spec.hs
16
test/Spec.hs
|
|
@ -1,2 +1,16 @@
|
||||||
|
import Control.Exception (evaluate)
|
||||||
|
import Test.Hspec
|
||||||
|
import Test.QuickCheck
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = putStrLn "Test suite not yet implemented"
|
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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue