1 {-# OPTIONS -fno-warn-orphans #-}
2 module QuickCheck.Trustee where
4 import Test.Tasty.QuickCheck
7 import Voting.Protocol.Trustees.All
10 import QuickCheck.Election ()
12 quickcheck :: TestTree
15 [ testGroup "verifyTrusteePublicKey" $
16 [ testTrusteePublicKey @WeakParams
17 , testTrusteePublicKey @BeleniosParams
21 testTrusteePublicKey :: forall q. Params q => TestTree
22 testTrusteePublicKey =
23 testGroup (paramsName @q)
24 [ testProperty "Right" $ \seed ->
26 (`evalStateT` mkStdGen seed) $ do
27 trustSecKey :: SecretKey q <- randomSecretKey
28 trustPubKey <- proveTrusteePublicKey trustSecKey
29 lift $ verifyTrusteePublicKey trustPubKey
32 instance SubGroup q => Arbitrary (TrusteePublicKey q) where
34 trustee_PublicKey <- arbitrary
35 trustee_SecretKeyProof <- arbitrary
36 return TrusteePublicKey{..}