From 2a56c6540e914611ac12647e157aec4c5c595758 Mon Sep 17 00:00:00 2001 From: Boyang Han Date: Fri, 19 Mar 2021 01:28:56 +0800 Subject: Add toString method to BitPat (#1819) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- src/test/scala/chiselTests/util/BitPatSpec.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/test/scala/chiselTests/util/BitPatSpec.scala (limited to 'src/test') diff --git a/src/test/scala/chiselTests/util/BitPatSpec.scala b/src/test/scala/chiselTests/util/BitPatSpec.scala new file mode 100644 index 00000000..a6c0acf7 --- /dev/null +++ b/src/test/scala/chiselTests/util/BitPatSpec.scala @@ -0,0 +1,17 @@ +// SPDX-License-Identifier: Apache-2.0 + +package chiselTests.util + +import chisel3.util.BitPat +import org.scalatest.flatspec.AnyFlatSpec +import org.scalatest.matchers.should.Matchers + + +class BitPatSpec extends AnyFlatSpec with Matchers { + behavior of classOf[BitPat].toString + + it should "convert a BitPat to readable form" in { + val testPattern = "0" * 32 + "1" * 32 + "?" * 32 + "?01" * 32 + BitPat("b" + testPattern).toString should be (s"BitPat($testPattern)") + } +} -- cgit v1.2.3