diff options
| author | Albert Magyar | 2020-02-18 19:59:41 -0700 |
|---|---|---|
| committer | GitHub | 2020-02-18 19:59:41 -0700 |
| commit | 235ec6cbdce6866c8fcd49c0000a7abeeaa4ef80 (patch) | |
| tree | 19a36d1bfd6bd7f9fb4b6fa805b57cbdc930f0e6 /src/test | |
| parent | 2c814ebe42dd4888a03aef6984b42b5158f1c541 (diff) | |
| parent | b9a1ccfd0c7ba082a193d50933de52c4eea6a1c0 (diff) | |
Merge pull request #1401 from freechipsproject/reachable-from-spec
Add more docs / tests for DiGraph reachableFrom method
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/scala/firrtlTests/graph/DiGraphTests.scala | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/graph/DiGraphTests.scala b/src/test/scala/firrtlTests/graph/DiGraphTests.scala index d3553a23..0771460b 100644 --- a/src/test/scala/firrtlTests/graph/DiGraphTests.scala +++ b/src/test/scala/firrtlTests/graph/DiGraphTests.scala @@ -150,4 +150,13 @@ class DiGraphTests extends FirrtlFlatSpec { dotLines.exists(s => s.contains(""""d" -> "k";""")) should be (true) dotLines.exists(s => s.contains("""rankdir="TB";""")) should be (true) } + + "reachableFrom" should "omit the queried node if no self-path exists" in { + degenerateGraph.reachableFrom("a") shouldBe empty + acyclicGraph.reachableFrom("b") should contain theSameElementsAs Vector("d", "e") + } + + "reachableFrom" should "include the queried node if it is included in a cycle" in { + cyclicGraph.reachableFrom("b") should contain theSameElementsAs Vector("a", "b", "c", "d") + } } |
