From 69623a9e090c4b3625a17f8dd48701e6dabc51f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 27 Oct 2023 17:51:55 +0200 Subject: Add basic tests for directed graph. --- tests/unit/util/graph.scm | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/unit/util/graph.scm (limited to 'tests/unit/util/graph.scm') diff --git a/tests/unit/util/graph.scm b/tests/unit/util/graph.scm new file mode 100644 index 00000000..43690fb5 --- /dev/null +++ b/tests/unit/util/graph.scm @@ -0,0 +1,22 @@ +(define-module (test hnh-util-graph) + :use-module (srfi srfi-64) + :use-module (srfi srfi-88) + :use-module ((hnh util) :select (->)) + :use-module (hnh util graph) + ) + +(define g (make-graph string->symbol + string=?)) + +(test-assert "New graphs are empty" (graph-empty? g)) + +(let ((g2 (-> g + (add-node "a" '()) + (add-node "b" '(a))))) + (test-assert "Changing graph doesn't change source graph" + (graph-empty? g)) + + (test-equal '("a" "b") + (resolve-dependency-graph g2))) + +'((hnh util graph)) -- cgit v1.2.3