diff options
Diffstat (limited to 'src/test/scala/firrtlTests/graph')
| -rw-r--r-- | src/test/scala/firrtlTests/graph/DiGraphTests.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/graph/DiGraphTests.scala b/src/test/scala/firrtlTests/graph/DiGraphTests.scala index 84122f83..b9f51699 100644 --- a/src/test/scala/firrtlTests/graph/DiGraphTests.scala +++ b/src/test/scala/firrtlTests/graph/DiGraphTests.scala @@ -29,6 +29,13 @@ class DiGraphTests extends FirrtlFlatSpec { "c" -> Set("d"), "d" -> Set("a"))) + val tupleGraph = DiGraph(Map( + ("a", 0) -> Set(("b", 2)), + ("a", 1) -> Set(("c", 3)), + ("b", 2) -> Set.empty[(String, Int)], + ("c", 3) -> Set.empty[(String, Int)] + )) + val degenerateGraph = DiGraph(Map("a" -> Set.empty[String])) acyclicGraph.findSCCs.filter(_.length > 1) shouldBe empty @@ -47,4 +54,8 @@ class DiGraphTests extends FirrtlFlatSpec { degenerateGraph.getEdgeMap should equal (degenerateGraph.reverse.getEdgeMap) + "transformNodes" should "combine vertices that collide, not drop them" in { + tupleGraph.transformNodes(_._1).getEdgeMap should contain ("a" -> Set("b", "c")) + } + } |
