Commits

Aleksey Khudyakov committed 8c80b66

Add property for identity functions

Comments (0)

Files changed (1)

Test/QuickCheck/Property/Generic.hs

     module Test.QuickCheck.Property.Common
     -- * General
   , prop_Reflexive
+  , prop_Identity
     -- * Monoids & group
   , prop_Associative
   , prop_Commutative
 prop_Reflexive :: (a -> a -> Bool) -> T a -> a -> Bool
 prop_Reflexive f T x = f x x
 
+-- | Test that function is identity. Useful for testing serializaion/deserialization
+--
+-- > f x = x
+prop_Identity :: (a -> a) -> T a -> a -> Equal a
+prop_Identity f T x = f x .==. x
 
 ----------------------------------------------------------------
 -- Monoids & Co