1 {-# LANGUAGE OverloadedStrings #-}
4 import GHC.Natural (minusNaturalMaybe)
5 import Data.Maybe (fromJust)
6 import Test.Tasty.HUnit
9 import qualified Data.Text as Text
11 hunit :: Reifies v Version => Proxy v -> TestTree
12 hunit _v = testGroup "FFC"
15 , hunitInv beleniosFFC
18 [ testGroup "WeakParams" $
19 reify weakFFC $ \(Proxy::Proxy c) ->
20 [ testCase "[groupGen]" $
21 hash "start" [groupGen :: G FFC c] @?=
23 , testCase "[groupGen, groupGen]" $
24 hash "start" [groupGen :: G FFC c, groupGen] @?=
27 , testGroup "BeleniosParams" $
28 reify beleniosFFC $ \(Proxy::Proxy c) ->
29 [ testCase "[groupGen]" $
30 hash "start" [groupGen :: G FFC c] @?=
31 fromNatural 75778590284190557660612328423573274641033882642784670156837892421285248292707
32 , testCase "[groupGen, groupGen]" $
33 hash "start" [groupGen :: G FFC c, groupGen] @?=
34 fromNatural 28798937720387703653439047952832768487958170248947132321730024269734141660223
41 ReifyCrypto crypto => Key crypto =>
44 testGroup (Text.unpack $ cryptoName crypto)
45 [ testCase "groupGen" $
46 reifyCrypto crypto $ \(_c::Proxy c) ->
47 inverse (groupGen :: G crypto c) @?=
48 groupGen ^ E (fromJust $ groupOrder (Proxy @c) `minusNaturalMaybe` one)