aboutsummaryrefslogtreecommitdiffstats
path: root/test/Property.hs
blob: 80c6f68a9f3edfec8dc5690fd7e831cca46a1733 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module Property (propertyTests) where

import qualified Data.Graph.Inductive              as G
import           Data.Graph.Inductive.PatriciaTree (Gr)
import           Test.Tasty
import qualified Test.Tasty.QuickCheck             as QC
import           VeriFuzz
import qualified VeriFuzz.Graph.RandomAlt          as V

newtype TestGraph = TestGraph { getGraph :: Gr Gate () }
                  deriving (Show)

newtype AltTestGraph = AltTestGraph { getAltGraph :: Gr Gate () }
                  deriving (Show)

instance QC.Arbitrary TestGraph where
  arbitrary = TestGraph <$> QC.resize 30 randomDAG

instance QC.Arbitrary AltTestGraph where
  arbitrary = AltTestGraph <$> QC.resize 100 V.randomDAG

simpleGraph = QC.testProperty "simple graph generation check" $
  \graph -> simp graph
  where simp = G.isSimple . getGraph

simpleAltGraph = QC.testProperty "simple alternative graph generation check" $
  \graph -> simp graph
  where simp = G.isSimple . getAltGraph

propertyTests :: TestTree
propertyTests = testGroup "Property Tests"
  [ simpleGraph
  , simpleAltGraph
  ]