1 {-# OPTIONS -fno-warn-orphans #-}
2 module QuickCheck.Trustee where
4 import Test.Tasty.QuickCheck
6 import Protocol.Arithmetic
7 import Protocol.Credential
8 import Protocol.Trustees.Simple
11 import QuickCheck.Election ()
13 quickcheck :: TestTree
16 [ testGroup "verifyTrusteePublicKey" $
17 [ testTrusteePublicKey @WeakParams
18 , testTrusteePublicKey @BeleniosParams
22 testTrusteePublicKey :: forall q. Params q => TestTree
23 testTrusteePublicKey =
24 testGroup (paramsName @q)
25 [ testProperty "Right" $ \seed ->
27 (`evalStateT` mkStdGen seed) $ do
28 trustSecKey :: SecretKey q <- randomSecretKey
29 trustPubKey <- proveTrusteePublicKey trustSecKey
30 lift $ verifyTrusteePublicKey trustPubKey
33 instance SubGroup q => Arbitrary (TrusteePublicKey q) where
35 trustee_PublicKey <- arbitrary
36 trustee_SecretKeyProof <- arbitrary
37 return TrusteePublicKey{..}