diff options
| author | Schuyler Eldridge | 2018-09-26 18:28:42 -0400 |
|---|---|---|
| committer | GitHub | 2018-09-26 18:28:42 -0400 |
| commit | 2ab5f866044d0d77756906b374813dd2425c5dfa (patch) | |
| tree | b1000d59ec709a548614a8ebac65ea76d77e603b /src/test/scala/firrtlTests/CheckSpec.scala | |
| parent | ba12915e9b93685107c503b3f91b96d491c48459 (diff) | |
| parent | 502c8dd35e6f27ed6794dad7ae9bcf4d41cc7474 (diff) | |
Merge pull request #898 from seldridge/port-uniqueness-checks
Enforce port uniqueness in Chirrtl/High Checks
Diffstat (limited to 'src/test/scala/firrtlTests/CheckSpec.scala')
| -rw-r--r-- | src/test/scala/firrtlTests/CheckSpec.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/CheckSpec.scala b/src/test/scala/firrtlTests/CheckSpec.scala index 3c9894ba..767f2392 100644 --- a/src/test/scala/firrtlTests/CheckSpec.scala +++ b/src/test/scala/firrtlTests/CheckSpec.scala @@ -282,4 +282,32 @@ class CheckSpec extends FlatSpec with Matchers { } } } + + behavior of "Uniqueness" + for ((description, input) <- CheckSpec.nonUniqueExamples) { + it should s"be asserted for $description" in { + assertThrows[CheckHighForm.NotUniqueException] { + Seq(ToWorkingIR, CheckHighForm).foldLeft(Parser.parse(input)){ case (c, tx) => tx.run(c) } + } + } + } } + +object CheckSpec { + val nonUniqueExamples = List( + ("two ports with the same name", + """|circuit Top: + | module Top: + | input a: UInt<1> + | input a: UInt<1>""".stripMargin), + ("two nodes with the same name", + """|circuit Top: + | module Top: + | node a = UInt<1>("h0") + | node a = UInt<1>("h0")""".stripMargin), + ("a port and a node with the same name", + """|circuit Top: + | module Top: + | input a: UInt<1> + | node a = UInt<1>("h0") """.stripMargin) ) + } |
