From 6ec5df16a38a7b53494ed3f52da039b8fa62175e Mon Sep 17 00:00:00 2001 From: Chick Markley Date: Mon, 2 Apr 2018 10:23:37 -0700 Subject: CyclicException identifies a problem node. (#778) Needed for special handling in Treadle. Small refactor that allows users of DiGraph#linearize to return the first node found in a cycle. Fixed RemoveWiresTransfrom to handle this. Added test to show usage of this feature.--- src/test/scala/firrtlTests/graph/DiGraphTests.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/test') diff --git a/src/test/scala/firrtlTests/graph/DiGraphTests.scala b/src/test/scala/firrtlTests/graph/DiGraphTests.scala index 147b22d7..a0f45c80 100644 --- a/src/test/scala/firrtlTests/graph/DiGraphTests.scala +++ b/src/test/scala/firrtlTests/graph/DiGraphTests.scala @@ -1,3 +1,5 @@ +// See LICENSE for license details. + package firrtlTests.graph import java.io._ @@ -50,6 +52,16 @@ class DiGraphTests extends FirrtlFlatSpec { a [CyclicException] should be thrownBy cyclicGraph.linearize + try { + cyclicGraph.linearize + } + catch { + case c: CyclicException => + c.getMessage.contains("found at a") should be (true) + c.node.asInstanceOf[String] should be ("a") + case _: Throwable => + } + acyclicGraph.reverse.getEdgeMap should equal (reversedAcyclicGraph.getEdgeMap) degenerateGraph.getEdgeMap should equal (degenerateGraph.reverse.getEdgeMap) -- cgit v1.2.3