Skip to content

Commit

Permalink
test(countcomb): add tricky tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ajlekcahdp4 authored and serjzimmerman committed Apr 17, 2024
1 parent 56d43ff commit 0ae4c74
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import chiseltest._
import org.scalatest.flatspec.AnyFlatSpec

class CountCombinationsTester extends AnyFlatSpec with ChiselScalatestTester {
"CountCombinations of 0b11 in 0b11111111" should "be equal to 7" in {
"CountCombinations of 0b11 in 0b11111111" should "be equal to 4" in {
test(new CountCombinations(8)) { dut =>
dut.io.value.poke("b11111111".U)
dut.io.count.expect(7.U)
dut.io.count.expect(4.U)
}
}

Expand All @@ -19,6 +19,19 @@ class CountCombinationsTester extends AnyFlatSpec with ChiselScalatestTester {
dut.io.count.expect(0.U)
}
}

"CountCombinations of 0b11 in 0b00000111" should "be equal to 1" in {
test(new CountCombinations(8)) { dut =>
dut.io.value.poke("b00000111".U)
dut.io.count.expect(1.U)
}
}
"CountCombinations of 0b11 in 0b11100111" should "be equal to 2" in {
test(new CountCombinations(8)) { dut =>
dut.io.value.poke("b11100111".U)
dut.io.count.expect(2.U)
}
}
}

class CountCombinationsTestbench(
Expand Down

0 comments on commit 0ae4c74

Please sign in to comment.