hspec-0.6.0: Behavior Driven Development for Haskell

Test.Hspec.QuickCheck

Description

Importing this module allows you to use a QuickCheck property as an example for a behavior. Use the property function to indicate a QuickCkeck property.

 describe "cutTheDeck" [
   it "puts the first half of a list after the last half"
      (property $ \ xs -> let top = take (length xs `div` 2) xs
                              bot = drop (length xs `div` 2) xs
                          in cutTheDeck xs == bot ++ top),

   it "restores an even sized list when cut twice"
      (property $ \ xs -> even (length xs) ==> cutTheDeck (cutTheDeck xs) == xs)
   ]

Synopsis

Documentation

property :: Testable a => a -> QuickCheckProperty aSource

prop :: Testable t => String -> t -> Writer [ItSpec] ()Source

Monadic DSL shortcut, use this instead of it