diff options
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/graph/DiGraphTests.scala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/graph/DiGraphTests.scala b/src/test/scala/firrtlTests/graph/DiGraphTests.scala index 6546e147..9eb1c7f8 100644 --- a/src/test/scala/firrtlTests/graph/DiGraphTests.scala +++ b/src/test/scala/firrtlTests/graph/DiGraphTests.scala @@ -16,12 +16,20 @@ class DiGraphTests extends FirrtlFlatSpec { "d" -> Set("e"), "e" -> Set.empty[String])) + val reversedAcyclicGraph = DiGraph(Map( + "a" -> Set.empty[String], + "b" -> Set("a"), + "c" -> Set("a"), + "d" -> Set("b", "c"), + "e" -> Set("d"))) + val cyclicGraph = DiGraph(Map( "a" -> Set("b","c"), "b" -> Set("d"), "c" -> Set("d"), "d" -> Set("a"))) + val degenerateGraph = DiGraph(Map("a" -> Set.empty[String])) acyclicGraph.findSCCs.filter(_.length > 1) shouldBe empty @@ -35,4 +43,8 @@ class DiGraphTests extends FirrtlFlatSpec { a [cyclicGraph.CyclicException] should be thrownBy cyclicGraph.linearize + acyclicGraph.reverse.edges should equal (reversedAcyclicGraph.edges) + + degenerateGraph.edges should equal (degenerateGraph.reverse.edges) + } |
