Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- randomNodeOf :: Graph n e -> Gen (Node n)
- randomNodeIdOf :: Graph n e -> Gen NodeId
- randomNodeInContextOf :: Graph n e -> Gen (NodeInContext n e)
- randomEdgeOf :: Graph n e -> Gen (Edge e)
- randomEdgeIdOf :: Graph n e -> Gen EdgeId
- randomEdgeInContextOf :: Graph n e -> Gen (EdgeInContext n e)
- randomGraph :: Gen n -> Gen e -> Int -> Int -> Gen (Graph n e)
- shrinkGraph :: Graph n e -> [Graph n e]
Documentation
randomNodeOf :: Graph n e -> Gen (Node n) Source #
Generate a random node that is a member of the given graph. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ nodes graph) ==> forAll (randomNodeOf graph) $ node -> someProperty graph node
randomNodeIdOf :: Graph n e -> Gen NodeId Source #
Generate a random node identifier that is a member of the given graph. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ nodes graph) ==> forAll (randomNodeIdOf graph) $ nodeId -> someProperty graph nodeId
randomNodeInContextOf :: Graph n e -> Gen (NodeInContext n e) Source #
Generate a random node that is a member of the given graph, along with its context. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ nodes graph) ==> forAll (randomNodeInContextOf graph) $ (node, ctx) -> someProperty graph node ctx
randomEdgeOf :: Graph n e -> Gen (Edge e) Source #
Generate a random edge that is a member of the given graph. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ edges graph) ==> forAll (randomEdgeOf graph) $ edge -> someProperty graph edge
randomEdgeIdOf :: Graph n e -> Gen EdgeId Source #
Generate a random edge identifier that is a member of the given graph. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ edges graph) ==> forAll (randomEdgeIdOf graph) $ edgeId -> someProperty graph edgeId
randomEdgeInContextOf :: Graph n e -> Gen (EdgeInContext n e) Source #
Generate a random edge that is a member of the given graph, along with its context. Must not be used with empty graphs, so calls to this are often similar to the following:
not (Prelude.null $ edges graph) ==> forAll (randomEdgeInContextOf graph) $ (edge, ctx) -> someProperty graph edge ctx
randomGraph :: Gen n -> Gen e -> Int -> Int -> Gen (Graph n e) Source #
Given generators for payloads, the number of nodes and the number of edges, generates a random graph.
shrinkGraph :: Graph n e -> [Graph n e] Source #
Produces all immediate shrinks of the given graph. Each shrink step may remove a single node (along with all its incident edges) or a single edge.