From 9f829c41651cd2872b1c6e666b5bceeebf829aee Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 9 Jan 2019 21:13:04 +0000 Subject: Move tests to test --- test/Property.hs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 test/Property.hs (limited to 'test/Property.hs') diff --git a/test/Property.hs b/test/Property.hs new file mode 100644 index 0000000..8fc9020 --- /dev/null +++ b/test/Property.hs @@ -0,0 +1,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 Test.VeriFuzz +import qualified Test.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 + ] -- cgit