aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Hynes2019-02-21 08:12:30 -0800
committerAdam Izraelevitz2019-02-21 08:12:30 -0800
commit021ecd1029f74e176f30e509d56cd00c98669791 (patch)
tree7c96571d8d20b2a7b3eb1a4dfc5b44083c08f377 /src/test
parentafdb780aeca80c1fed94dd20fd22037490169472 (diff)
Correctly handle dots in loaded memory paths (#984)
* Correctly handle dots in loaded memory paths * Added test for loadmem filename
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala b/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala
new file mode 100644
index 00000000..15b12d52
--- /dev/null
+++ b/src/test/scala/firrtlTests/annotationTests/LoadMemoryAnnotationSpec.scala
@@ -0,0 +1,29 @@
+// See LICENSE for license details.
+
+package firrtlTests.annotationTests
+
+import firrtl.annotations.{CircuitName, ComponentName, LoadMemoryAnnotation, ModuleName}
+import org.scalatest.{FreeSpec, Matchers}
+
+class LoadMemoryAnnotationSpec extends FreeSpec with Matchers {
+ "LoadMemoryAnnotation getFileName" - {
+ "add name of subcomponent to file name when a memory was split" in {
+ val lma = new LoadMemoryAnnotation(
+ ComponentName("init_mem_subdata", ModuleName("b", CircuitName("c"))),
+ "somepath/init_mem",
+ originalMemoryNameOpt = Some("init_mem")
+ )
+
+ lma.getFileName should be("somepath/init_mem_subdata")
+ }
+ "and do that properly when there are dots in earlier sections of the path" in {
+ val lma = new LoadMemoryAnnotation(
+ ComponentName("init_mem_subdata", ModuleName("b", CircuitName("c"))),
+ "./target/scala-2.12/test-classes/init_mem",
+ originalMemoryNameOpt = Some("init_mem")
+ )
+
+ lma.getFileName should be("./target/scala-2.12/test-classes/init_mem_subdata")
+ }
+ }
+}