X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=unit-tests%2Ftest-api.lisp;fp=unit-tests%2Ftest-api.lisp;h=e1d42065c58358a82cf3bc9a1b174294e7a71558;hb=30d6c8f9bd55ddefd48d333bfeb73b1a2a333e99;hp=c7125436fbba11bb195989f15910a634c1f3ebf0;hpb=a419a81fe65c79b62f1b9aef584572f7a21cf294;p=cl-graph.git diff --git a/unit-tests/test-api.lisp b/unit-tests/test-api.lisp index c712543..e1d4206 100644 --- a/unit-tests/test-api.lisp +++ b/unit-tests/test-api.lisp @@ -37,3 +37,35 @@ (eq b (target-vertex edge))) target-edges) :report "targets"))) +(addtest (test-api + :documentation "case 218") + parents-of-child-vertexes + (let* ((g (build-single-diamond-graph :directed)) + (b (find-vertex g 'b)) + (child-vertexes (child-vertexes b))) + (ensure (every (lambda (vertex) + (member b (parent-vertexes vertex))) + child-vertexes) :report "children"))) + +(addtest (test-api + :documentation "case 218") + children-of-parent-vertexes + (let* ((g (build-single-diamond-graph :directed)) + (b (find-vertex g 'b)) + (parent-vertexes (parent-vertexes b))) + (ensure (every (lambda (vertex) + (member b (child-vertexes vertex))) + parent-vertexes) :report "parents"))) + +(addtest (test-api + :documentation "case 218") + parents-and-children=are-correct + (let* ((g (build-single-diamond-graph :directed)) + (b (find-vertex g 'b)) + (child-vertexes (child-vertexes b)) + (parent-vertexes (parent-vertexes b))) + (ensure-same child-vertexes (list (find-vertex g 'c) + (find-vertex g 'i)) + :test 'set-equal)) + (ensure-same parent-vertexes (list (find-vertex g 'a)) + :test 'set-equal))