diff options
| author | Albert Magyar | 2020-02-18 18:29:44 -0800 |
|---|---|---|
| committer | Albert Magyar | 2020-02-18 18:29:44 -0800 |
| commit | b9a1ccfd0c7ba082a193d50933de52c4eea6a1c0 (patch) | |
| tree | 19a36d1bfd6bd7f9fb4b6fa805b57cbdc930f0e6 /src | |
| parent | 7be32e531db4073e2ff28a63c99bfa31ef02feb5 (diff) | |
Add test case for reachableFrom behavior w.r.t. including root
Diffstat (limited to 'src')
| -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") + } } |
