diff --git a/src/test/scala/projet/ZzTopCommon.scala b/src/test/scala/projet/ZzTopCommon.scala index 3025901..a8573ec 100644 --- a/src/test/scala/projet/ZzTopCommon.scala +++ b/src/test/scala/projet/ZzTopCommon.scala @@ -7,19 +7,21 @@ import chisel3.simulator.scalatest.ChiselSim object ZzTopCommon extends AnyFreeSpec with ChiselSim { def expectedValuesFromAsm(path: String): Seq[BigInt] = { - val line = - Source.fromFile(path).getLines().find(_.startsWith("# expected:")) - line match { - case Some(l) => - l.stripPrefix("# expected:") + Source + .fromFile(path) + .getLines() + .filter(_.startsWith("# expected:")) + .map( + _.stripPrefix("# expected:") .split(",") .map(_.trim) .filter(_.nonEmpty) .map(str => BigInt(str, 16)) .toSeq - case None => - Seq.empty - } + ) + .fold(Seq.empty)((acc, line) => { + acc.concat(line) + }) } def failTrace(msg: String = "Erreur", trace: ListBuffer[String]): Unit = {