on master help sign in
arrange property tests in groups
7d1e6aaHarendra Kumar
test/Prop.hs+54−46
@@ -6,7 +6,7 @@ import Control.Monad (replicateM)
6import Data.List (sort)
6import Data.List (sort)
7import GHC.Word (Word8)
7import GHC.Word (Word8)
8
8
9−import Test.Hspec (hspec, Spec)
9+import Test.Hspec (hspec, Spec, describe)
10import Test.Hspec.QuickCheck (prop)
10import Test.Hspec.QuickCheck (prop)
11import Test.QuickCheck (counterexample, Property)
11import Test.QuickCheck (counterexample, Property)
12import Test.QuickCheck.Monadic (run, monadicIO, monitor, assert, PropertyM)
12import Test.QuickCheck.Monadic (run, monadicIO, monitor, assert, PropertyM)
@@ -239,52 +239,60 @@ monadBind t eq (a, b) =
239
239
240main :: IO ()
240main :: IO ()
241main = hspec $ do
241main = hspec $ do
242+ describe "Construction" $ do
242− prop "serially replicateM" $ constructWithReplicateM serially
243+ prop "serially replicateM" $ constructWithReplicateM serially
243
244
245+ describe "Functor operations" $ do
244− functorOps "serially" serially
246+ functorOps "serially" serially
245− functorOps "interleaving" interleaving
247+ functorOps "interleaving" interleaving
246− functorOps "zipping" zipping
248+ functorOps "zipping" zipping
247− functorOps "asyncly" asyncly
249+ functorOps "asyncly" asyncly
248− functorOps "parallely" parallely
250+ functorOps "parallely" parallely
249− functorOps "zippingAsync" zippingAsync
251+ functorOps "zippingAsync" zippingAsync
250
252
253+ describe "Semigroup operations" $ do
251− semigroupOps "serially" serially
254+ semigroupOps "serially" serially
252− semigroupOps "interleaving" interleaving
255+ semigroupOps "interleaving" interleaving
253
256
254− -- The tests using sorted equality are weaker tests
255− -- We need to have stronger unit tests for all those
256− -- XXX applicative with three arguments
257 let sortEq a b = sort a == sort b
257 let sortEq a b = sort a == sort b
258+ describe "Applicative operations" $ do
259+ -- The tests using sorted equality are weaker tests
260+ -- We need to have stronger unit tests for all those
261+ -- XXX applicative with three arguments
258− prop "serially applicative" $ applicativeOps serially (==)
262+ prop "serially applicative" $ applicativeOps serially (==)
259− prop "interleaving applicative" $ applicativeOps interleaving sortEq
263+ prop "interleaving applicative" $ applicativeOps interleaving sortEq
260− prop "asyncly applicative" $ applicativeOps asyncly sortEq
264+ prop "asyncly applicative" $ applicativeOps asyncly sortEq
261− prop "parallely applicative" $ applicativeOps parallely sortEq
265+ prop "parallely applicative" $ applicativeOps parallely sortEq
266+
267+ describe "Zip operations" $ do
262− prop "zipping applicative" $ zipApplicative zipping (==)
268+ prop "zipping applicative" $ zipApplicative zipping (==)
263− -- XXX this hangs
269+ -- XXX this hangs
264− -- prop "zippingAsync applicative" $ zipApplicative zippingAsync (==)
270+ -- prop "zippingAsync applicative" $ zipApplicative zippingAsync (==)
265− prop "zip monadic serially" $ zipMonadic serially (==)
271+ prop "zip monadic serially" $ zipMonadic serially (==)
266− prop "zip monadic interleaving" $ zipMonadic interleaving (==)
272+ prop "zip monadic interleaving" $ zipMonadic interleaving (==)
267− prop "zip monadic asyncly" $ zipMonadic asyncly (==)
273+ prop "zip monadic asyncly" $ zipMonadic asyncly (==)
268− prop "zip monadic parallely" $ zipMonadic parallely (==)
274+ prop "zip monadic parallely" $ zipMonadic parallely (==)
269−
275+
276+ describe "Monad operations" $ do
270− prop "serially monad then" $ monadThen serially (==)
277+ prop "serially monad then" $ monadThen serially (==)
271− prop "interleaving monad then" $ monadThen interleaving sortEq
278+ prop "interleaving monad then" $ monadThen interleaving sortEq
272− prop "asyncly monad then" $ monadThen asyncly sortEq
279+ prop "asyncly monad then" $ monadThen asyncly sortEq
273− prop "parallely monad then" $ monadThen parallely sortEq
280+ prop "parallely monad then" $ monadThen parallely sortEq
274−
281+
275− prop "serially monad bind" $ monadBind serially (==)
282+ prop "serially monad bind" $ monadBind serially (==)
276− prop "interleaving monad bind" $ monadBind interleaving sortEq
283+ prop "interleaving monad bind" $ monadBind interleaving sortEq
277− prop "asyncly monad bind" $ monadBind asyncly sortEq
284+ prop "asyncly monad bind" $ monadBind asyncly sortEq
278− prop "parallely monad bind" $ monadBind parallely sortEq
285+ prop "parallely monad bind" $ monadBind parallely sortEq
279−
286+
287+ describe "Stream operations" $ do
280− transformOps "serially" serially
288+ transformOps "serially" serially
281− transformOps "interleaving" interleaving
289+ transformOps "interleaving" interleaving
282− transformOps "zipping" zipping
290+ transformOps "zipping" zipping
283− transformOps "asyncly" asyncly
291+ transformOps "asyncly" asyncly
284− transformOps "parallely" parallely
292+ transformOps "parallely" parallely
285−
293+
286− transformOpsWord8 "serially" serially
294+ transformOpsWord8 "serially" serially
287− transformOpsWord8 "interleaving" interleaving
295+ transformOpsWord8 "interleaving" interleaving
288− transformOpsWord8 "zipping" zipping
296+ transformOpsWord8 "zipping" zipping
289− transformOpsWord8 "asyncly" asyncly
297+ transformOpsWord8 "asyncly" asyncly
290− transformOpsWord8 "parallely" parallely
298+ transformOpsWord8 "parallely" parallely