1 {-# OPTIONS -fno-warn-orphans #-}
2 {-# LANGUAGE UndecidableInstances #-} -- for Reifies instances
3 module QuickCheck.Trustee where
5 import Test.Tasty.QuickCheck
6 import qualified Data.Text as Text
11 import QuickCheck.Election ()
13 quickcheck :: TestTree
16 [ testGroup "verifyIndispensableTrusteePublicKey" $
17 [ testIndispensableTrusteePublicKey weakFFC
18 , testIndispensableTrusteePublicKey beleniosFFC
22 testIndispensableTrusteePublicKey :: FFC -> TestTree
23 testIndispensableTrusteePublicKey ffc =
24 reify ffc $ \(Proxy::Proxy c) ->
25 testGroup (Text.unpack $ ffc_name ffc)
26 [ testProperty "Right" $ \seed ->
28 (`evalStateT` mkStdGen seed) $ do
29 trusteeSecKey :: SecretKey c <- randomSecretKey
30 trusteePubKey <- proveIndispensableTrusteePublicKey trusteeSecKey
31 lift $ verifyIndispensableTrusteePublicKey trusteePubKey
34 instance Reifies c FFC => Arbitrary (TrusteePublicKey c) where
36 trustee_PublicKey <- arbitrary
37 trustee_SecretKeyProof <- arbitrary
38 return TrusteePublicKey{..}