aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Laeufer2020-08-26 14:18:18 -0700
committerGitHub2020-08-26 21:18:18 +0000
commitb1fa0356d1dd8a4c29827c0e9bdd8c5ff79631f7 (patch)
treea5ccc936f1a53e0dbc2f3fe00b3cc1895061bec4 /src
parentc9a320b00ec31bc971cba0f09d1bbf3851733c46 (diff)
Scalafmt check all (#1867)
* run scalafmtAll * ci: scalafmtCheckAll to check all code instead of just the main sources
Diffstat (limited to 'src')
-rw-r--r--src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala24
-rw-r--r--src/test/scala/firrtlTests/SerializerSpec.scala40
2 files changed, 33 insertions, 31 deletions
diff --git a/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala b/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
index 5fee87c9..1bf7261f 100644
--- a/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
+++ b/src/test/scala/firrtlTests/InlineBooleanExpressionsSpec.scala
@@ -1,4 +1,3 @@
-
// See LICENSE for license details.
package firrtlTests
@@ -14,13 +13,16 @@ import firrtl.stage.TransformManager
class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
val transform = new InlineBooleanExpressions
val transforms: Seq[Transform] = new TransformManager(
- transform.prerequisites
- ).flattenedTransformOrder :+ transform
+ transform.prerequisites
+ ).flattenedTransformOrder :+ transform
protected def exec(input: String, annos: Seq[Annotation] = Nil) = {
- transforms.foldLeft(CircuitState(parse(input), UnknownForm, AnnotationSeq(annos))) {
- (c: CircuitState, t: Transform) => t.runTransform(c)
- }.circuit.serialize
+ transforms
+ .foldLeft(CircuitState(parse(input), UnknownForm, AnnotationSeq(annos))) { (c: CircuitState, t: Transform) =>
+ t.runTransform(c)
+ }
+ .circuit
+ .serialize
}
it should "inline mux operands" in {
@@ -47,7 +49,7 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
| node _y = mux(lt(x1, x2), head(x1, 1), head(x2, 1))
| out <= mux(lt(x1, x2), head(x1, 1), head(x2, 1))""".stripMargin
val result = exec(input)
- (result) should be (parse(check).serialize)
+ (result) should be(parse(check).serialize)
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
@@ -87,7 +89,7 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
|
| outB <= _y @[B]""".stripMargin
val result = exec(input)
- (result) should be (parse(check).serialize)
+ (result) should be(parse(check).serialize)
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
@@ -128,7 +130,7 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
|
| outB <= lt(andr(head(_c, 1)), x2)""".stripMargin
val result = exec(input)
- (result) should be (parse(check).serialize)
+ (result) should be(parse(check).serialize)
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
@@ -173,7 +175,7 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
|
| outB <= geq(x1, gt(x1, leq(x1, lt(x1, x2))))""".stripMargin
val result = exec(input)
- (result) should be (parse(check).serialize)
+ (result) should be(parse(check).serialize)
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
@@ -219,7 +221,7 @@ class InlineBooleanExpressionsSpec extends FirrtlFlatSpec {
|
| out <= or(or(or(_3, c_4), c_5), c_6)""".stripMargin
val result = exec(input, Seq(InlineBooleanExpressionsMax(3)))
- (result) should be (parse(check).serialize)
+ (result) should be(parse(check).serialize)
firrtlEquivalenceTest(input, Seq(new InlineBooleanExpressions))
}
diff --git a/src/test/scala/firrtlTests/SerializerSpec.scala b/src/test/scala/firrtlTests/SerializerSpec.scala
index 8892de4b..750759dc 100644
--- a/src/test/scala/firrtlTests/SerializerSpec.scala
+++ b/src/test/scala/firrtlTests/SerializerSpec.scala
@@ -11,27 +11,27 @@ import org.scalatest.matchers.should.Matchers
object SerializerSpec {
case class WrapStmt(stmt: Statement) extends Statement {
def serialize: String = s"wrap(${stmt.serialize})"
- def foreachExpr(f: Expression => Unit): Unit = stmt.foreachExpr(f)
- def foreachInfo(f: Info => Unit): Unit = stmt.foreachInfo(f)
- def foreachStmt(f: Statement => Unit): Unit = stmt.foreachStmt(f)
- def foreachString(f: String => Unit): Unit = stmt.foreachString(f)
- def foreachType(f: Type => Unit): Unit = stmt.foreachType(f)
- def mapExpr(f: Expression => Expression): Statement = this.copy(stmt.mapExpr(f))
- def mapInfo(f: Info => Info): Statement = this.copy(stmt.mapInfo(f))
- def mapStmt(f: Statement => Statement): Statement = this.copy(stmt.mapStmt(f))
- def mapString(f: String => String): Statement = this.copy(stmt.mapString(f))
- def mapType(f: Type => Type): Statement = this.copy(stmt.mapType(f))
+ def foreachExpr(f: Expression => Unit): Unit = stmt.foreachExpr(f)
+ def foreachInfo(f: Info => Unit): Unit = stmt.foreachInfo(f)
+ def foreachStmt(f: Statement => Unit): Unit = stmt.foreachStmt(f)
+ def foreachString(f: String => Unit): Unit = stmt.foreachString(f)
+ def foreachType(f: Type => Unit): Unit = stmt.foreachType(f)
+ def mapExpr(f: Expression => Expression): Statement = this.copy(stmt.mapExpr(f))
+ def mapInfo(f: Info => Info): Statement = this.copy(stmt.mapInfo(f))
+ def mapStmt(f: Statement => Statement): Statement = this.copy(stmt.mapStmt(f))
+ def mapString(f: String => String): Statement = this.copy(stmt.mapString(f))
+ def mapType(f: Type => Type): Statement = this.copy(stmt.mapType(f))
}
case class WrapExpr(expr: Expression) extends Expression {
def serialize: String = s"wrap(${expr.serialize})"
- def tpe: Type = expr.tpe
- def foreachExpr(f: Expression => Unit): Unit = expr.foreachExpr(f)
- def foreachType(f: Type => Unit): Unit = expr.foreachType(f)
- def foreachWidth(f: Width => Unit): Unit = expr.foreachWidth(f)
- def mapExpr(f: Expression => Expression): Expression = this.copy(expr.mapExpr(f))
- def mapType(f: Type => Type): Expression = this.copy(expr.mapType(f))
- def mapWidth(f: Width => Width): Expression = this.copy(expr.mapWidth(f))
+ def tpe: Type = expr.tpe
+ def foreachExpr(f: Expression => Unit): Unit = expr.foreachExpr(f)
+ def foreachType(f: Type => Unit): Unit = expr.foreachType(f)
+ def foreachWidth(f: Width => Unit): Unit = expr.foreachWidth(f)
+ def mapExpr(f: Expression => Expression): Expression = this.copy(expr.mapExpr(f))
+ def mapType(f: Type => Type): Expression = this.copy(expr.mapType(f))
+ def mapWidth(f: Width => Width): Expression = this.copy(expr.mapWidth(f))
}
}
@@ -41,13 +41,13 @@ class SerializerSpec extends AnyFlatSpec with Matchers {
"ir.Serializer" should "support custom Statements" in {
val stmt = WrapStmt(DefWire(NoInfo, "myWire", Utils.BoolType))
val ser = "wrap(wire myWire : UInt<1>)"
- Serializer.serialize(stmt) should be (ser)
+ Serializer.serialize(stmt) should be(ser)
}
it should "support custom Expression" in {
val expr = WrapExpr(Reference("foo"))
val ser = "wrap(foo)"
- Serializer.serialize(expr) should be (ser)
+ Serializer.serialize(expr) should be(ser)
}
it should "support nested custom Statements and Expressions" in {
@@ -55,7 +55,7 @@ class SerializerSpec extends AnyFlatSpec with Matchers {
val stmt = WrapStmt(DefNode(NoInfo, "n", expr))
val stmts = Block(stmt :: Nil)
val ser = "wrap(node n = wrap(foo).bar)"
- Serializer.serialize(stmts) should be (ser)
+ Serializer.serialize(stmts) should be(ser)
}
}