]> Git — Sourcephile - majurity.git/blob - hjugement-protocol/test/HUnit/Arithmetic.hs
protocol: Rename {Arith -> Arithmetic}
[majurity.git] / hjugement-protocol / test / HUnit / Arithmetic.hs
1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE TypeApplications #-}
4 module HUnit.Arithmetic where
5
6 import Protocol.Arithmetic
7 import HUnit.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] @?= inE 80
27 , testCase "[groupGen, groupGen]" $
28 hash "start" [groupGen @WeakParams, groupGen] @?= inE 117
29 ]
30 , testGroup "BeleniosParams"
31 [ testCase "[groupGen]" $
32 hash "start" [groupGen @BeleniosParams] @?=
33 inE 1115773133278002110129249165266
34 , testCase "[groupGen, groupGen]" $
35 hash "start" [groupGen @BeleniosParams, groupGen] @?=
36 inE 1237765159213600087872608890753
37 ]
38 ]
39 ]