-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | check quickCheck properties in real time. -- -- Test.Properties is flexible and readable way of codifing and executing -- assertions. The properties can be defined right within the class or -- the code for which the properties apply. -- -- Instead of testing properties with automatically generate values in a -- separate test program,this package permits to test them on the fly -- while the real application run, with the data produced within. So -- somehow it unites the readability of QuickCheck and the flexibility of -- assert. It is simple and straighforward But is by no means perfect. no -- statistics and so on. Just trace messages are sent. -- -- The primary purpose of this package was to define class properties and -- to check their instances. The properties can be defined within a -- class. so no additional exports are necessary. checking instaces can -- be done within the instance declarations. But it can be used anywhere -- assertions are used. It can be attached to arbitrary piece of code for -- which the property group holds. The defined properties can be used for -- casual debugging. -- -- The package includes complete examples. @package properties @version 0.0.2 module Test.Properties -- | Check a list of properties. when a property is violated, a trace error -- is printed at the end i return the first value, just like (flip trace) -- must be used as opeator: -- --
--   expression  verify properties with value tuple
--   
-- -- Example: -- --
--   stringProperty= Property "length" (\(x, y)-> length (x++y)== length x + length y)
--   
--   main= do
--           let s=  "hello "
--           let s2= "world"
--           print $ s++ s2        `verify` stringProperty `with`(s,s2)
--           print "that's all!"
--   
-- -- It is possible to check quickCheck style properties. The same example -- with a quickCheck style property: -- --
--   quickCheckProperty x y=  length (x++y)== length x + length y
--   
--   main= do
--           let s=  "hello "
--           let s2= "world"
--           print $ s++ s2        `verify` [Property "stringSumLength" $ uncurry quickCheckProperty] `with`(s,s2)
--           print "that's all!"
--   
verify :: (Show b) => a -> [Property (b -> Bool)] -> b -> a -- | A labeled property includes a string label and an expression data Property a Property :: String -> a -> Property a -- | Properties is a convenient way to express list of properties with the -- same arity. data Properties a b c Properties :: [Property (a -> Bool)] -> [Property ((a, b) -> Bool)] -> [Property ((a, b, c) -> Bool)] -> Properties a b c unary :: Properties a b c -> [Property (a -> Bool)] binary :: Properties a b c -> [Property ((a, b) -> Bool)] ternary :: Properties a b c -> [Property ((a, b, c) -> Bool)] -- | empty properties: properties= Properties [] [] [] properties :: Properties a b c -- | to improve readability: with= ($) with :: (a -> b) -> a -> b