diff options
| author | ducky | 2016-10-25 13:46:44 -0700 |
|---|---|---|
| committer | ducky | 2016-11-21 12:48:10 -0800 |
| commit | 667a26bddb6133e8b243061f8a5fc5fe586cc1ae (patch) | |
| tree | 25fd7452e45a1b15355e2fb91009290d47aeb89e /src | |
| parent | 822160cc8e76e70643fb56707bb39f6f7526b6fd (diff) | |
Range macro initial impl
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/scala/chiselTests/RangeMacroTest.scala | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/scala/chiselTests/RangeMacroTest.scala b/src/test/scala/chiselTests/RangeMacroTest.scala new file mode 100644 index 00000000..797c75c4 --- /dev/null +++ b/src/test/scala/chiselTests/RangeMacroTest.scala @@ -0,0 +1,31 @@ +// See LICENSE for license details. + +package chiselTests + +import chisel3._ +import scala.language.experimental.macros +import org.scalatest._ +import org.scalatest.prop._ +import chisel3.testers.BasicTester + +package object rangeMacroTest { + +implicit class ChiselRange(val sc: StringContext) extends AnyVal { + def range(args: Any*): Unit = macro chisel3.internal.RangeTransform.apply +} + +} + +import rangeMacroTest._ + +/** Comprehensive test of static range parsing functionality. + * Note: negative (failure) conditions can't be tested because they will fail at compile time, + * before the testing environment is entered. + */ +@dump +class RangeMacroTest extends ChiselPropSpec { + property("Range macros should work") { + def ducks() = {2} + range" (0, ${ducks}] " + } +} |
