1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 05:11:44 +03:00
semantic/test/Data/Semigroup/App/Spec.hs

27 lines
867 B
Haskell
Raw Normal View History

module Data.Semigroup.App.Spec (testTree) where
2018-10-31 22:47:30 +03:00
import Data.Semigroup.App
import Hedgehog
import qualified Hedgehog.Gen as Gen
import qualified Hedgehog.Range as Range
import Properties
import qualified Test.Tasty as Tasty
import qualified Test.Tasty.Hedgehog as Tasty
2018-10-31 22:47:30 +03:00
app :: MonadGen m => m (App Maybe Integer)
app = App <$> Gen.maybe (Gen.integral (Range.linear 0 10000))
2018-10-31 22:47:30 +03:00
merge :: MonadGen m => m (AppMerge Maybe String)
merge = AppMerge <$> Gen.maybe (Gen.string (Range.linear 0 10) Gen.ascii)
2018-10-31 22:47:30 +03:00
testTree :: Tasty.TestTree
testTree = Tasty.testGroup "Data.Semigroup.App"
[ Tasty.testGroup "App"
[ Tasty.testProperty "is associative" (associative (<>) app)
]
, Tasty.testGroup "AppMerge"
[ Tasty.testProperty "is associative" (associative (<>) merge)
, Tasty.testProperty "is monoidal" (monoidal merge)
]
]