]> Git — Sourcephile - majurity.git/blob - hjugement-protocol/test/HUnit/Arith.hs
protocol: Add Arith
[majurity.git] / hjugement-protocol / test / HUnit / Arith.hs
1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE TypeApplications #-}
4 module HUnit.Arith where
5
6 import Protocol.Arith
7 import HUnit.Utils
8
9 hunit :: TestTree
10 hunit = testGroup "Arith"
11 [ testGroup "inv"
12 [ testGroup "WeakParams"
13 [ testCase "groupGen" $
14 inv (groupGen @WeakParams) @?=
15 groupGen ^ (groupOrder @WeakParams + neg one)
16 ]
17 , testGroup "BeleniosParams"
18 [ testCase "groupGen" $
19 inv (groupGen @BeleniosParams) @?=
20 groupGen ^ (groupOrder @BeleniosParams + neg one)
21 ]
22 ]
23 , testGroup "hash"
24 [ testGroup "WeakParams"
25 [ testCase "[groupGen]" $
26 hash "start" [groupGen @WeakParams] @?= F 197
27 , testCase "[groupGen, groupGen]" $
28 hash "start" [groupGen @WeakParams, groupGen] @?= F 70
29 ]
30 , testGroup "BeleniosParams"
31 [ testCase "[groupGen]" $
32 hash "start" [groupGen @BeleniosParams] @?=
33 F 1115773133278002110129249165266
34 , testCase "[groupGen, groupGen]" $
35 hash "start" [groupGen @BeleniosParams, groupGen] @?=
36 F 1237765159213600087872608890753
37 ]
38 ]
39 ]