2016-06-23 23:30:43 +03:00
|
|
|
{-# LANGUAGE DataKinds #-}
|
2015-12-17 21:08:47 +03:00
|
|
|
module TermSpec where
|
|
|
|
|
2016-06-01 16:16:47 +03:00
|
|
|
import Data.Text.Arbitrary ()
|
|
|
|
import Prologue
|
|
|
|
import Term.Arbitrary
|
|
|
|
import Test.Hspec
|
|
|
|
import Test.Hspec.QuickCheck
|
2016-06-01 18:52:43 +03:00
|
|
|
import Test.QuickCheck
|
2015-12-17 21:08:47 +03:00
|
|
|
|
|
|
|
spec :: Spec
|
2016-01-05 18:38:51 +03:00
|
|
|
spec = parallel $ do
|
2015-12-17 21:08:47 +03:00
|
|
|
describe "Term" $ do
|
|
|
|
prop "equality is reflexive" $
|
2016-06-27 20:21:32 +03:00
|
|
|
\ a -> toTerm a `shouldBe` toTerm (a :: ArbitraryTerm Text ())
|
2015-12-17 21:08:47 +03:00
|
|
|
|
2016-06-27 20:12:37 +03:00
|
|
|
describe "ArbitraryTerm" $ do
|
2016-06-27 20:16:56 +03:00
|
|
|
prop "generates terms of a specific size" . forAll ((arbitrary >>= \ n -> (,) n <$> termOfSize n) `suchThat` ((> 0) . fst)) $
|
|
|
|
\ (n, term) -> arbitraryTermSize (term :: ArbitraryTerm Text ()) `shouldBe` n
|