aboutsummaryrefslogtreecommitdiffstats
path: root/src/Test
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2018-12-29 22:29:53 +0100
committerYann Herklotz <ymherklotz@gmail.com>2018-12-29 22:30:06 +0100
commiteb0eb0f85e7e656c43cf9cb27bc142ae5a349efc (patch)
treee7f0f859295a09a3659918ff2042b7bfb3b6db17 /src/Test
parent2c84e82a0263c9bf87cc660a9aabeb5f69828253 (diff)
downloadverismith-eb0eb0f85e7e656c43cf9cb27bc142ae5a349efc.tar.gz
verismith-eb0eb0f85e7e656c43cf9cb27bc142ae5a349efc.zip
Add alternative generation method
Diffstat (limited to 'src/Test')
-rw-r--r--src/Test/VeriFuzz/Graph/RandomAlt.hs29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/Test/VeriFuzz/Graph/RandomAlt.hs b/src/Test/VeriFuzz/Graph/RandomAlt.hs
new file mode 100644
index 0000000..9fe72e2
--- /dev/null
+++ b/src/Test/VeriFuzz/Graph/RandomAlt.hs
@@ -0,0 +1,29 @@
+{-|p
+Module : Test.VeriFuzz.Graph.RandomAlt
+Description : RandomAlt generation for DAG
+Copyright : (c) 2018-2019, Yann Herklotz Grave
+License : BSD-3
+Maintainer : ymherklotz [at] gmail [dot] com
+Stability : experimental
+Portability : POSIX
+
+Define the random generation for the directed acyclic graph.
+-}
+
+module Test.VeriFuzz.Graph.RandomAlt where
+
+import Data.Graph.Inductive (Graph, LEdge, mkGraph)
+import qualified Data.Graph.Inductive.Arbitrary as G
+import Data.Graph.Inductive.PatriciaTree (Gr)
+import Test.QuickCheck (Arbitrary, Gen)
+import qualified Test.QuickCheck as QC
+
+randomDAG :: (Arbitrary l, Arbitrary e)
+ => Gen (Gr l e)
+randomDAG =
+ G.looplessGraph <$> QC.arbitrary
+
+-- | Generate a random acyclic DAG with an IO instance.
+genRandomDAG :: (Arbitrary l, Arbitrary e)
+ => IO (Gr l e)
+genRandomDAG = QC.generate randomDAG