1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 15:35:14 +03:00
semantic/test/TermSpec.hs

20 lines
597 B
Haskell
Raw Normal View History

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