]> Git — Sourcephile - majurity.git/blob - hjugement/test/QuickCheck/Gauge.hs
protocol: Add Election
[majurity.git] / hjugement / test / QuickCheck / Gauge.hs
1 module QuickCheck.Gauge where
2 import Data.Bool
3 import Data.Function (($))
4 import Data.Ord (Ord(..), Ordering(..))
5 import Majority.Merit
6 import Test.Tasty
7 import Test.Tasty.QuickCheck
8
9 import Majority.Judgment
10 import QuickCheck.Merit ()
11 import QuickCheck.Utils
12 import Types
13
14 quickcheck :: TestTree
15 quickcheck =
16 testGroup "Gauge"
17 [ testProperty "majorityGauge and majorityValue consistency" $
18 \(SameLength (x::Merit SchoolGrade, y)) ->
19 case majorityGauge x`compare`majorityGauge y of
20 LT -> majorityValue x < majorityValue y
21 GT -> majorityValue y < majorityValue x
22 EQ -> True
23 ]