1 {-# OPTIONS -fno-warn-orphans #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE UndecidableInstances #-} -- for Reifies instances
4 module QuickCheck.Trustee where
6 import Test.Tasty.QuickCheck
7 import qualified Data.Text as Text
12 import QuickCheck.Election ()
14 quickcheck :: Reifies v Version => Proxy v -> TestTree
17 [ testGroup "verifyIndispensableTrusteePublicKey" $
18 [ testIndispensableTrusteePublicKey v weakFFC
19 , testIndispensableTrusteePublicKey v beleniosFFC
23 testIndispensableTrusteePublicKey ::
25 Reifies v Version => Proxy v ->
27 testIndispensableTrusteePublicKey (_v::Proxy v) crypto =
28 reifyCrypto crypto $ \(Proxy::Proxy c) ->
29 testGroup (Text.unpack $ cryptoName crypto)
30 [ testProperty "Right" $ \seed ->
32 (`evalStateT` mkStdGen seed) $ do
33 trusteeSecKey :: SecretKey crypto c <- randomSecretKey
34 trusteePubKey :: TrusteePublicKey crypto v c
35 <- proveIndispensableTrusteePublicKey trusteeSecKey
36 lift $ verifyIndispensableTrusteePublicKey trusteePubKey
43 , Multiplicative (FieldElement crypto c)
44 ) => Arbitrary (TrusteePublicKey crypto v c) where
46 trustee_PublicKey <- arbitrary
47 trustee_SecretKeyProof <- arbitrary
48 return TrusteePublicKey{..}