diff options
| author | ducky | 2015-12-11 12:47:44 -0800 |
|---|---|---|
| committer | ducky | 2015-12-11 12:53:39 -0800 |
| commit | 5859d231859c6a8b9c234e7a71cbc85e5d75f61b (patch) | |
| tree | f8115324c12c54a3077517f5b6b997cc16951c64 /src/test/scala/chiselTests/Assert.scala | |
| parent | 20951ecdbcb81c194ddcdd1e8241b1bdd647dd9f (diff) | |
Add support for printf and asserts, add testbench for asserts and printf
Diffstat (limited to 'src/test/scala/chiselTests/Assert.scala')
| -rw-r--r-- | src/test/scala/chiselTests/Assert.scala | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/Assert.scala b/src/test/scala/chiselTests/Assert.scala new file mode 100644 index 00000000..31e53f36 --- /dev/null +++ b/src/test/scala/chiselTests/Assert.scala @@ -0,0 +1,28 @@ +// See LICENSE for license details. + +package chiselTests + +import org.scalatest._ +import Chisel._ +import Chisel.testers.BasicTester + +class FailingAssertTester() extends BasicTester { + assert(Bool(false)) + io.done := Bool(true) + io.error := Bool(false) +} + +class SucceedingAssertTester() extends BasicTester { + assert(Bool(true)) + io.done := Bool(true) + io.error := Bool(false) +} + +class AssertSpec extends ChiselFlatSpec { + "A failing assertion" should "fail the testbench" in { + assert(!execute{ new FailingAssertTester }) + } + "A succeeding assertion" should "not fail the testbench" in { + assert(execute{ new SucceedingAssertTester }) + } +} |
