feat: x86 code generation implementation without runtime checking #29
@@ -39,7 +39,26 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll {
|
|||||||
// Retrieve contents to get input and expected output + exit code
|
// Retrieve contents to get input and expected output + exit code
|
||||||
val contents = scala.io.Source.fromFile(File(filename)).getLines.toList
|
val contents = scala.io.Source.fromFile(File(filename)).getLines.toList
|
||||||
val inputLine =
|
val inputLine =
|
||||||
contents.find(_.matches("^# ?[Ii]nput:.*$")).map(_.split(":").last.strip).getOrElse("")
|
contents
|
||||||
|
.find(_.matches("^# ?[Ii]nput:.*$"))
|
||||||
|
.map(line =>
|
||||||
|
("" :: line.split(":").last.strip.split(" ").toList)
|
||||||
|
.sliding(2)
|
||||||
|
.flatMap { arr =>
|
||||||
|
if (
|
||||||
|
// First entry has no space in front
|
||||||
|
arr(0) == "" ||
|
||||||
|
// int followed by non-digit, space can be removed
|
||||||
|
arr(0).toIntOption.nonEmpty && !arr(1)(0).isDigit ||
|
||||||
|
// non-int followed by int, space can be removed
|
||||||
|
!arr(0).last.isDigit && arr(1).toIntOption.nonEmpty
|
||||||
|
)
|
||||||
|
then List(arr(1))
|
||||||
|
else List(" ", arr(1))
|
||||||
|
}
|
||||||
|
.mkString
|
||||||
|
)
|
||||||
|
.getOrElse("")
|
||||||
val outputLineIdx = contents.indexWhere(_.matches("^# ?[Oo]utput:.*$"))
|
val outputLineIdx = contents.indexWhere(_.matches("^# ?[Oo]utput:.*$"))
|
||||||
val expectedOutput =
|
val expectedOutput =
|
||||||
if (outputLineIdx == -1) ""
|
if (outputLineIdx == -1) ""
|
||||||
@@ -95,7 +114,7 @@ class ParallelExamplesSpec extends AnyFlatSpec with BeforeAndAfterAll {
|
|||||||
// "^.*wacc-examples/valid/if.*$",
|
// "^.*wacc-examples/valid/if.*$",
|
||||||
// "^.*wacc-examples/valid/IO/print.*$",
|
// "^.*wacc-examples/valid/IO/print.*$",
|
||||||
// "^.*wacc-examples/valid/IO/read.*$",
|
// "^.*wacc-examples/valid/IO/read.*$",
|
||||||
"^.*wacc-examples/valid/IO/IOLoop.wacc.*$",
|
// "^.*wacc-examples/valid/IO/IOLoop.wacc.*$",
|
||||||
// "^.*wacc-examples/valid/IO/IOSequence.wacc.*$",
|
// "^.*wacc-examples/valid/IO/IOSequence.wacc.*$",
|
||||||
// "^.*wacc-examples/valid/pairs.*$",
|
// "^.*wacc-examples/valid/pairs.*$",
|
||||||
"^.*wacc-examples/valid/runtimeErr.*$",
|
"^.*wacc-examples/valid/runtimeErr.*$",
|
||||||
|
|||||||
Reference in New Issue
Block a user