Skip to content

Commit

Permalink
Add property prop_determinePoolRegistrationStatus_differentPools.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Jul 9, 2020
1 parent 30e6616 commit a6f3ddf
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions lib/core/test/unit/Cardano/Pool/DB/Properties.hs
Expand Up @@ -167,12 +167,15 @@ properties = do
(property . prop_unfetchedPoolMetadataRefs)
it "unfetchedPoolMetadataRefsIgnoring"
(property . prop_unfetchedPoolMetadataRefsIgnoring)
it "prop_determinePoolRegistrationStatus_orderCorrect" $
it "prop_determinePoolRegistrationStatus_orderCorrect"
(property . const
prop_determinePoolRegistrationStatus_orderCorrect)
it "prop_determinePoolRegistrationStatus_neverRegistered" $
it "prop_determinePoolRegistrationStatus_neverRegistered"
(property . const
prop_determinePoolRegistrationStatus_neverRegistered)
it "prop_determinePoolRegistrationStatus_differentPools"
(property . const
prop_determinePoolRegistrationStatus_differentPools)

{-------------------------------------------------------------------------------
Properties
Expand Down Expand Up @@ -625,6 +628,26 @@ prop_determinePoolRegistrationStatus_neverRegistered maybeRetData =
where
result = determinePoolRegistrationStatus Nothing maybeRetData

prop_determinePoolRegistrationStatus_differentPools
:: forall certificatePublicationTime . (certificatePublicationTime ~ Int)
=> (certificatePublicationTime, PoolRegistrationCertificate)
-> (certificatePublicationTime, PoolRetirementCertificate)
-> Property
prop_determinePoolRegistrationStatus_differentPools regData retData =
property $ (regPoolId /= retPoolId) ==> prop
where
prop = evaluate result `shouldThrow` anyException

regPoolId = view #poolId regCert
retPoolId = view #poolId retCert

(regTime, regCert) = regData
(retTime, retCert) = retData

result = determinePoolRegistrationStatus
(pure (regTime, regCert))
(pure (retTime, retCert))

descSlotsPerPool :: Map PoolId [BlockHeader] -> Expectation
descSlotsPerPool pools = do
let checkIfDesc slots =
Expand Down

0 comments on commit a6f3ddf

Please sign in to comment.