Required values in tests can be splitted on several lines

This commit is contained in:
2025-11-10 11:19:40 +01:00
parent cbfd806444
commit d225894765

View File

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