Skip to content

Commit

Permalink
refactoring #3 | inline loop and remove test intrumentation from test…
Browse files Browse the repository at this point in the history
… logic
  • Loading branch information
KtorZ committed Mar 11, 2019
1 parent 66db21a commit 1b28cb1
Showing 1 changed file with 32 additions and 14 deletions.
46 changes: 32 additions & 14 deletions test/unit/Cardano/Wallet/BlockSyncerSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,40 @@ import qualified Data.Set as Set
spec :: Spec
spec = do
describe "Block syncer downloads blocks properly" $ do
let tests =
[
("check ticking function when blocks are sent in exactly-once fashion"
, ExactlyOnce)
,
("check ticking function when blocks are sent in at-least-once fashion"
, AtLeastOnce)
]
forM_ ((L.take 10 . L.cycle) tests) $ \pair ->
uncurry tickingFunctionTest pair
it "Check ticking function when blocks are sent in exactly-one fashion" $
tickingFunctionTest ExactlyOnce

it "Check ticking function when blocks are sent in exactly-one fashion" $
tickingFunctionTest ExactlyOnce

it "Check ticking function when blocks are sent in exactly-one fashion" $
tickingFunctionTest ExactlyOnce

it "Check ticking function when blocks are sent in exactly-one fashion" $
tickingFunctionTest ExactlyOnce

it "Check ticking function when blocks are sent in exactly-one fashion" $
tickingFunctionTest ExactlyOnce

it "Check ticking function when blocks are sent in at-least-once fashion" $
tickingFunctionTest AtLeastOnce

it "Check ticking function when blocks are sent in at-least-once fashion" $
tickingFunctionTest AtLeastOnce

it "Check ticking function when blocks are sent in at-least-once fashion" $
tickingFunctionTest AtLeastOnce

it "Check ticking function when blocks are sent in at-least-once fashion" $
tickingFunctionTest AtLeastOnce

it "Check ticking function when blocks are sent in at-least-once fashion" $
tickingFunctionTest AtLeastOnce
where
tickingFunctionTest
:: String
-> DeliveryMode
-> SpecWith (Arg (IO ()))
tickingFunctionTest testDescr deliveryMode = it testDescr $ do
:: DeliveryMode
-> IO ()
tickingFunctionTest deliveryMode = do
chunkSizesToTest <- generateBlockChunkSizes
tickingFunctionTime <- generate $ choose (1,3)
let testTime = (L.length chunkSizesToTest + 1)*(fromIntegral tickingFunctionTime)*1000*1000
Expand Down

0 comments on commit 1b28cb1

Please sign in to comment.