on master help sign in
arrange property tests in groups
commit7d1e6aa16321df77955a91c825bb397f7e49aef5 authorHarendra Kumar <harendra.kumar@gmail.com> dateSat 14 Apr 2018, 15:10 (9 years ago) parent722efd6
1 file changed+54−46
test/Prop.hs+54−46
test/Prop.hs+54−46
@@ -6,7 +6,7 @@ import Control.Monad (replicateM)
66import Data.List (sort)
77import GHC.Word (Word8)
88
9−import Test.Hspec (hspec, Spec)
9+import Test.Hspec (hspec, Spec, describe)
1010import Test.Hspec.QuickCheck (prop)
1111import Test.QuickCheck (counterexample, Property)
1212import Test.QuickCheck.Monadic (run, monadicIO, monitor, assert, PropertyM)
@@ -239,52 +239,60 @@ monadBind t eq (a, b) =
239239
240240main :: IO ()
241241main = hspec $ do
242− prop "serially replicateM" $ constructWithReplicateM serially
242+ describe "Construction" $ do
243+ prop "serially replicateM" $ constructWithReplicateM serially
243244
244− functorOps "serially" serially
245− functorOps "interleaving" interleaving
246− functorOps "zipping" zipping
247− functorOps "asyncly" asyncly
248− functorOps "parallely" parallely
249− functorOps "zippingAsync" zippingAsync
245+ describe "Functor operations" $ do
246+ functorOps "serially" serially
247+ functorOps "interleaving" interleaving
248+ functorOps "zipping" zipping
249+ functorOps "asyncly" asyncly
250+ functorOps "parallely" parallely
251+ functorOps "zippingAsync" zippingAsync
250252
251− semigroupOps "serially" serially
252− semigroupOps "interleaving" interleaving
253+ describe "Semigroup operations" $ do
254+ semigroupOps "serially" serially
255+ semigroupOps "interleaving" interleaving
253256
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
257257 let sortEq a b = sort a == sort b
258− prop "serially applicative" $ applicativeOps serially (==)
259− prop "interleaving applicative" $ applicativeOps interleaving sortEq
260− prop "asyncly applicative" $ applicativeOps asyncly sortEq
261− prop "parallely applicative" $ applicativeOps parallely sortEq
262− prop "zipping applicative" $ zipApplicative zipping (==)
263− -- XXX this hangs
264− -- prop "zippingAsync applicative" $ zipApplicative zippingAsync (==)
265− prop "zip monadic serially" $ zipMonadic serially (==)
266− prop "zip monadic interleaving" $ zipMonadic interleaving (==)
267− prop "zip monadic asyncly" $ zipMonadic asyncly (==)
268− prop "zip monadic parallely" $ zipMonadic parallely (==)
269−
270− prop "serially monad then" $ monadThen serially (==)
271− prop "interleaving monad then" $ monadThen interleaving sortEq
272− prop "asyncly monad then" $ monadThen asyncly sortEq
273− prop "parallely monad then" $ monadThen parallely sortEq
274−
275− prop "serially monad bind" $ monadBind serially (==)
276− prop "interleaving monad bind" $ monadBind interleaving sortEq
277− prop "asyncly monad bind" $ monadBind asyncly sortEq
278− prop "parallely monad bind" $ monadBind parallely sortEq
279−
280− transformOps "serially" serially
281− transformOps "interleaving" interleaving
282− transformOps "zipping" zipping
283− transformOps "asyncly" asyncly
284− transformOps "parallely" parallely
285−
286− transformOpsWord8 "serially" serially
287− transformOpsWord8 "interleaving" interleaving
288− transformOpsWord8 "zipping" zipping
289− transformOpsWord8 "asyncly" asyncly
290− transformOpsWord8 "parallely" parallely
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
262+ prop "serially applicative" $ applicativeOps serially (==)
263+ prop "interleaving applicative" $ applicativeOps interleaving sortEq
264+ prop "asyncly applicative" $ applicativeOps asyncly sortEq
265+ prop "parallely applicative" $ applicativeOps parallely sortEq
266+
267+ describe "Zip operations" $ do
268+ prop "zipping applicative" $ zipApplicative zipping (==)
269+ -- XXX this hangs
270+ -- prop "zippingAsync applicative" $ zipApplicative zippingAsync (==)
271+ prop "zip monadic serially" $ zipMonadic serially (==)
272+ prop "zip monadic interleaving" $ zipMonadic interleaving (==)
273+ prop "zip monadic asyncly" $ zipMonadic asyncly (==)
274+ prop "zip monadic parallely" $ zipMonadic parallely (==)
275+
276+ describe "Monad operations" $ do
277+ prop "serially monad then" $ monadThen serially (==)
278+ prop "interleaving monad then" $ monadThen interleaving sortEq
279+ prop "asyncly monad then" $ monadThen asyncly sortEq
280+ prop "parallely monad then" $ monadThen parallely sortEq
281+
282+ prop "serially monad bind" $ monadBind serially (==)
283+ prop "interleaving monad bind" $ monadBind interleaving sortEq
284+ prop "asyncly monad bind" $ monadBind asyncly sortEq
285+ prop "parallely monad bind" $ monadBind parallely sortEq
286+
287+ describe "Stream operations" $ do
288+ transformOps "serially" serially
289+ transformOps "interleaving" interleaving
290+ transformOps "zipping" zipping
291+ transformOps "asyncly" asyncly
292+ transformOps "parallely" parallely
293+
294+ transformOpsWord8 "serially" serially
295+ transformOpsWord8 "interleaving" interleaving
296+ transformOpsWord8 "zipping" zipping
297+ transformOpsWord8 "asyncly" asyncly
298+ transformOpsWord8 "parallely" parallely