]> Git — Sourcephile - majurity.git/blob - hjugement-protocol/test/HUnit/Arithmetic.hs
protocol: add key derivation
[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] @?= inE 80
26 , testCase "[groupGen, groupGen]" $
27 hash "start" [groupGen @WeakParams, groupGen] @?= inE 117
28 ]
29 , testGroup "BeleniosParams"
30 [ testCase "[groupGen]" $
31 hash "start" [groupGen @BeleniosParams] @?=
32 inE 1115773133278002110129249165266
33 , testCase "[groupGen, groupGen]" $
34 hash "start" [groupGen @BeleniosParams, groupGen] @?=
35 inE 1237765159213600087872608890753
36 ]
37 ]
38 ]