{-# LANGUAGE OverloadedStrings #-} module Hedgehog.Laws.Eq where import Hedgehog qualified import Hedgehog.Laws.Common import Prelude import Test.Tasty (TestTree, testGroup) import Test.Tasty.Hedgehog (testProperty) eqLaws :: (Show a, Eq a) => Hedgehog.Gen a -> TestTree eqLaws :: forall a. (Show a, Eq a) => Gen a -> TestTree eqLaws Gen a g = TestName -> [TestTree] -> TestTree testGroup TestName "equivalence relation laws" [ TestName -> Property -> TestTree testProperty TestName "reflexive" (Gen a -> (a -> a -> Bool) -> Property forall a. Show a => Gen a -> (a -> a -> Bool) -> Property prop_reflexive Gen a g a -> a -> Bool forall a. Eq a => a -> a -> Bool (==)) , TestName -> Property -> TestTree testProperty TestName "symmetric" (Gen a -> (a -> a -> Bool) -> Property forall a. (Show a, Eq a) => Gen a -> (a -> a -> Bool) -> Property prop_symmetric Gen a g a -> a -> Bool forall a. Eq a => a -> a -> Bool (==)) , TestName -> Property -> TestTree testProperty TestName "transitive" (Gen a -> (a -> a -> Bool) -> Property forall a. (Show a, Eq a) => Gen a -> (a -> a -> Bool) -> Property prop_transitive Gen a g a -> a -> Bool forall a. Eq a => a -> a -> Bool (==)) ]