Skip to content

Commit

Permalink
Adjust number of test cases
Browse files Browse the repository at this point in the history
Reimplementation of #496 targetting #819, which include the more general
changes of #500.
  • Loading branch information
Niols committed Dec 6, 2023
1 parent 911f78d commit 28aabf3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ import Test.Tasty
import Test.Tasty.QuickCheck
import Test.Util.Orphans.IOLike ()
import Test.Util.TestBlock (TestBlock, unTestHash)
import Test.Util.TestEnv (adjustQuickCheckTests)

tests :: TestTree
tests =
testGroup "long range attack" [
adjustQuickCheckTests (`div` 10) $
testProperty "one adversary" (prop_longRangeAttack 1 [10])
-- TODO we don't have useful classification logic for multiple adversaries yet – if a selectable
-- adversary is slow, it might be discarded before it reaches critical length because the faster
Expand All @@ -57,7 +59,7 @@ prop_longRangeAttack honestFreq advFreqs = do

-- TODO: not existsSelectableAdversary ==> immutableTipBeforeFork svSelectedChain

pure $ withMaxSuccess 10 $
pure $
classify (genesisWindowAfterIntersection cls) "Full genesis window after intersection" $
allAdversariesSelectable cls
==>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,18 @@ import Test.Tasty
import Test.Tasty.QuickCheck
import Test.Util.Orphans.IOLike ()
import Test.Util.TestBlock (TestBlock, unTestHash)
import Test.Util.TestEnv (adjustQuickCheckTests)

tests :: TestTree
tests = testGroup "rollback" [
testProperty "can rollback" (prop_rollback True),
-- NOTE: The property @prop_rollback True@ discards a lot of inputs, making
-- it quite flakey. We increase the maximum number of discarded tests per
-- successful ones so as to make this test more reliable.
adjustQuickCheckTests (`div` 10) $
localOption (QuickCheckMaxRatio 100) $
testProperty "can rollback" (prop_rollback True)
,
adjustQuickCheckTests (`div` 10) $
testProperty "cannot rollback" (prop_rollback False)
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ import Test.QuickCheck
import Test.Tasty
import Test.Tasty.QuickCheck
import Test.Util.Orphans.IOLike ()
import Test.Util.TestEnv (adjustQuickCheckTests)

tests :: TestTree
tests = testProperty "timeouts" prop_timeouts
tests = adjustQuickCheckTests (`div` 10) $ testProperty "timeouts" prop_timeouts

prop_timeouts :: QC.Gen QC.Property
prop_timeouts = do
Expand All @@ -45,7 +46,7 @@ prop_timeouts = do
(fromJust $ mustReplyTimeout (scChainSyncTimeouts schedulerConfig))
(btTrunk $ gtBlockTree genesisTest)

pure $ withMaxSuccess 10 $ runSimOrThrow $
pure $ runSimOrThrow $
runTest schedulerConfig genesisTest schedule $ \stateView ->
case svChainSyncExceptions stateView of
[] ->
Expand Down

0 comments on commit 28aabf3

Please sign in to comment.