]> Git — Sourcephile - majurity.git/blob - hjugement-protocol/tests/HUnit/Arithmetic.hs
protocol: polish tally
[majurity.git] / hjugement-protocol / tests / HUnit / Arithmetic.hs
1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 module HUnit.Arithmetic where
4
5 import Test.Tasty.HUnit
6 import Voting.Protocol
7 import Utils
8
9 hunit :: TestTree
10 hunit = testGroup "Arithmetic"
11 [ testGroup "inv"
12 [ testGroup "WeakParams"
13 [ testCase "groupGen" $
14 inv (groupGen @WeakParams) @?=
15 groupGen ^ E (groupOrder @WeakParams + neg one)
16 ]
17 , testGroup "BeleniosParams"
18 [ testCase "groupGen" $
19 inv (groupGen @BeleniosParams) @?=
20 groupGen ^ E (groupOrder @BeleniosParams + neg one)
21 ]
22 ]
23 , testGroup "hash"
24 [ testGroup "WeakParams"
25 [ testCase "[groupGen]" $
26 hash "start" [groupGen @WeakParams] @?=
27 fromNatural 100
28 , testCase "[groupGen, groupGen]" $
29 hash "start" [groupGen @WeakParams, groupGen] @?=
30 fromNatural 16
31 ]
32 , testGroup "BeleniosParams"
33 [ testCase "[groupGen]" $
34 hash "start" [groupGen @BeleniosParams] @?=
35 fromNatural 1832875488615060263192702367259
36 , testCase "[groupGen, groupGen]" $
37 hash "start" [groupGen @BeleniosParams, groupGen] @?=
38 fromNatural 2495277906542783643199702546512
39 ]
40 ]
41 ]