{-# OPTIONS -fno-warn-orphans #-} module QuickCheck.Trustee where import Test.Tasty.QuickCheck import Voting.Protocol import Utils import QuickCheck.Election () quickcheck :: TestTree quickcheck = testGroup "Trustee" [ testGroup "verifyIndispensableTrusteePublicKey" $ [ testIndispensableTrusteePublicKey @WeakParams , testIndispensableTrusteePublicKey @BeleniosParams ] ] testIndispensableTrusteePublicKey :: forall q. Params q => TestTree testIndispensableTrusteePublicKey = testGroup (paramsName @q) [ testProperty "Right" $ \seed -> isRight $ runExcept $ (`evalStateT` mkStdGen seed) $ do trusteeSecKey :: SecretKey q <- randomSecretKey trusteePubKey <- proveIndispensableTrusteePublicKey trusteeSecKey lift $ verifyIndispensableTrusteePublicKey trusteePubKey ] instance SubGroup q => Arbitrary (TrusteePublicKey q) where arbitrary = do trustee_PublicKey <- arbitrary trustee_SecretKeyProof <- arbitrary return TrusteePublicKey{..}