aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorChick Markley2018-04-02 10:23:37 -0700
committerGitHub2018-04-02 10:23:37 -0700
commit6ec5df16a38a7b53494ed3f52da039b8fa62175e (patch)
tree47b81990e151b13a5435c7ee5bc713a58a2e9553 /src/test
parent396ee7ca63eb8a9e201dcdea965cbfc3e9d36783 (diff)
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.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/graph/DiGraphTests.scala12
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 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)