From c23943b41de55de9af249a3b231558ad23fc8087 Mon Sep 17 00:00:00 2001 From: Henry Cook Date: Fri, 14 Aug 2015 01:51:39 -0700 Subject: Add Vec tests. Do a better job of generating widths. --- src/test/scala/chiselTests/ChiselSpec.scala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/test/scala/chiselTests/ChiselSpec.scala') diff --git a/src/test/scala/chiselTests/ChiselSpec.scala b/src/test/scala/chiselTests/ChiselSpec.scala index 3485b398..3d98d0a2 100644 --- a/src/test/scala/chiselTests/ChiselSpec.scala +++ b/src/test/scala/chiselTests/ChiselSpec.scala @@ -41,7 +41,7 @@ class ChiselPropSpec extends PropSpec with PropertyChecks { def popCount(n: Long) = n.toBinaryString.count(_=='1') val smallPosInts = Gen.choose(1, 7) - val safeUIntWidth = Gen.choose(1, 31) + val safeUIntWidth = Gen.choose(1, 30) val safeUInts = Gen.choose(0, (1 << 30)) val vecSizes = Gen.choose(0, 4) val binaryString = for(i <- Arbitrary.arbitrary[Int]) yield "b" + i.toBinaryString @@ -51,10 +51,19 @@ class ChiselPropSpec extends PropSpec with PropertyChecks { w <- smallPosInts i <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) } yield (w, i) + val safeUInt = for { + w <- smallPosInts + i <- Gen.choose(0, (1 << w) - 1) + } yield (w, i) def safeUIntPairN(n: Int) = for { w <- smallPosInts i <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) j <- Gen.containerOfN[List,Int](n, Gen.choose(0, (1 << w) - 1)) } yield (w, i zip j) + val safeUIntPair= for { + w <- smallPosInts + i <- Gen.choose(0, (1 << w) - 1) + j <- Gen.choose(0, (1 << w) - 1) + } yield (w, i, j) } -- cgit v1.2.3