aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/scala/firrtlTests/fixed/FixedSerializationSpec.scala27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/scala/firrtlTests/fixed/FixedSerializationSpec.scala b/src/test/scala/firrtlTests/fixed/FixedSerializationSpec.scala
new file mode 100644
index 00000000..db107cb3
--- /dev/null
+++ b/src/test/scala/firrtlTests/fixed/FixedSerializationSpec.scala
@@ -0,0 +1,27 @@
+// See LICENSE for license details.
+
+package firrtlTests
+package fixed
+
+import firrtl.ir
+import org.scalatest.flatspec.AnyFlatSpec
+
+class FixedSerializationSpec extends AnyFlatSpec {
+ behavior of "FixedType"
+
+ it should "serialize correctly" in {
+ assert(ir.FixedType(ir.IntWidth(3), ir.IntWidth(2)).serialize == "Fixed<3><<2>>")
+ assert(ir.FixedType(ir.IntWidth(10), ir.UnknownWidth).serialize == "Fixed<10>")
+ assert(ir.FixedType(ir.UnknownWidth, ir.IntWidth(-4)).serialize == "Fixed<<-4>>")
+ assert(ir.FixedType(ir.UnknownWidth, ir.UnknownWidth).serialize == "Fixed")
+ }
+
+ behavior of "FixedLiteral"
+
+ it should "serialize correctly" in {
+ assert(ir.FixedLiteral(1, ir.IntWidth(3), ir.IntWidth(2)).serialize == "Fixed<3><<2>>(\"h1\")")
+ assert(ir.FixedLiteral(1, ir.IntWidth(10), ir.UnknownWidth).serialize == "Fixed<10>(\"h1\")")
+ assert(ir.FixedLiteral(1, ir.UnknownWidth, ir.IntWidth(-4)).serialize == "Fixed<<-4>>(\"h1\")")
+ assert(ir.FixedLiteral(1, ir.UnknownWidth, ir.UnknownWidth).serialize == "Fixed(\"h1\")")
+ }
+}