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