aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-27 17:51:55 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-11-06 00:46:25 +0100
commit69623a9e090c4b3625a17f8dd48701e6dabc51f6 (patch)
tree0d536495ce5a0e6c93a1112c7b122f8bca73b87c
parentFinish coverage for week-1-start. (diff)
downloadcalp-69623a9e090c4b3625a17f8dd48701e6dabc51f6.tar.gz
calp-69623a9e090c4b3625a17f8dd48701e6dabc51f6.tar.xz
Add basic tests for directed graph.
-rw-r--r--tests/unit/util/graph.scm22
1 files changed, 22 insertions, 0 deletions
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))