diff options
| author | Jack Koenig | 2017-02-08 21:40:45 -0800 |
|---|---|---|
| committer | GitHub | 2017-02-08 21:40:45 -0800 |
| commit | abb05d0569dd6b6c3e736a4db2ea739d767b3c3f (patch) | |
| tree | a8ba8bd21a6b9a7263c92853f474d57bac30880a /src/test/scala/chiselTests | |
| parent | 66a72ff64c46d8a9fdade77223de62b4dcfe2825 (diff) | |
Fix random failures in CompatibilitySpec (#498)
Diffstat (limited to 'src/test/scala/chiselTests')
| -rw-r--r-- | src/test/scala/chiselTests/CompatibiltySpec.scala | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/test/scala/chiselTests/CompatibiltySpec.scala b/src/test/scala/chiselTests/CompatibiltySpec.scala index dc55527c..cc14be5e 100644 --- a/src/test/scala/chiselTests/CompatibiltySpec.scala +++ b/src/test/scala/chiselTests/CompatibiltySpec.scala @@ -35,17 +35,13 @@ class CompatibiltySpec extends ChiselFlatSpec with GeneratorDrivenPropertyChecks } it should "map utility objects into the package object" in { - { - val value: Int = Gen.choose(0, 2048).sample.get - log2Up(value) shouldBe (1 max BigInt(value - 1).bitLength) - log2Ceil(value) shouldBe (BigInt(value - 1).bitLength) - log2Down(value) shouldBe ((1 max BigInt(value - 1).bitLength) - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) - log2Floor(value) shouldBe (BigInt(value - 1).bitLength - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) - if (value > 0) { - isPow2(1 << value) shouldBe true - isPow2((1 << value) - 1) shouldBe false - } - } + val value: Int = Gen.choose(2, 2048).sample.get + log2Up(value) shouldBe (1 max BigInt(value - 1).bitLength) + log2Ceil(value) shouldBe (BigInt(value - 1).bitLength) + log2Down(value) shouldBe ((1 max BigInt(value - 1).bitLength) - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) + log2Floor(value) shouldBe (BigInt(value - 1).bitLength - (if (value > 0 && ((value & (value - 1)) == 0)) 0 else 1)) + isPow2(BigInt(1) << value) shouldBe true + isPow2((BigInt(1) << value) - 1) shouldBe false } it should "make BitPats available" in { |
