summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-23 23:03:23 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-24 00:06:01 +0200
commite144e3427da93b962c7620ce2bd64add8c83cfdc (patch)
tree2f1cd6dd65e764e8dab09d5fa97f86a62664617d /tests
parent623e4df42abd024e0a62ef0b30f9b550f37cba57 (diff)
downloadgnu-guix-e144e3427da93b962c7620ce2bd64add8c83cfdc.tar
gnu-guix-e144e3427da93b962c7620ce2bd64add8c83cfdc.tar.gz
graph: Add 'node-reachable-count'.
* guix/graph.scm (node-reachable-count): New procedure. * tests/graph.scm ("node-reachable-count"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/graph.scm13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/graph.scm b/tests/graph.scm
index 32317195d7..1ce06cc817 100644
--- a/tests/graph.scm
+++ b/tests/graph.scm
@@ -275,4 +275,17 @@ edges."
(return (lset= eq? (node-transitive-edges (list p2) edges)
(list p1a p1b p0)))))))
+(test-equal "node-reachable-count"
+ '(3 3)
+ (run-with-store %store
+ (let* ((p0 (dummy-package "p0"))
+ (p1a (dummy-package "p1a" (inputs `(("p0" ,p0)))))
+ (p1b (dummy-package "p1b" (inputs `(("p0" ,p0)))))
+ (p2 (dummy-package "p2" (inputs `(("p1a" ,p1a) ("p1b" ,p1b))))))
+ (mlet* %store-monad ((all -> (list p2 p1a p1b p0))
+ (edges (node-edges %package-node-type all))
+ (back (node-back-edges %package-node-type all)))
+ (return (list (node-reachable-count (list p2) edges)
+ (node-reachable-count (list p0) back)))))))
+
(test-end "graph")