Skip to content

Commit

Permalink
Merge pull request #71 from UQ-PAC/new-ir
Browse files Browse the repository at this point in the history
Improved stack identification, many other changes
  • Loading branch information
ailrst authored Sep 19, 2023
2 parents 7b9472f + 4413a34 commit ecc244f
Show file tree
Hide file tree
Showing 359 changed files with 782,867 additions and 16,891 deletions.
39 changes: 33 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import scala.sys.process.Process
import scala.io.Source

ThisBuild / scalaVersion := "3.1.0"
ThisBuild / version := "0.0.1"
Expand All @@ -8,8 +8,8 @@ val javaTests = "com.novocode" % "junit-interface" % "0.11" % "test"
val scalaTests = "org.scalatest" %% "scalatest" % "3.2.10" % "test"
val scalactic = "org.scalactic" %% "scalactic" % "3.2.10"
val antlrRuntime = "org.antlr" % "antlr4-runtime" % "4.9.3"
val sourceCode = "com.lihaoyi" %% "sourcecode" % "0.3.0"
val mainArgs = "com.lihaoyi" %% "mainargs" % "0.5.1"
val sourceCode = "com.lihaoyi" %% "sourcecode" % "0.3.0"
val mainArgs = "com.lihaoyi" %% "mainargs" % "0.5.1"

lazy val root = project
.in(file("."))
Expand All @@ -18,14 +18,14 @@ lazy val root = project
name := "wptool-boogie",
Antlr4 / antlr4Version := "4.9.3",
Antlr4 / antlr4GenVisitor := true,
Antlr4 / antlr4PackageName := Some("BilParser"),
Antlr4 / antlr4PackageName := Some("Parsers"),
Compile / run / mainClass := Some("Main"),
libraryDependencies += javaTests,
libraryDependencies += antlrRuntime,
libraryDependencies += scalactic,
libraryDependencies += scalaTests,
libraryDependencies += sourceCode,
libraryDependencies += mainArgs
libraryDependencies += mainArgs
)

lazy val updateExpected = taskKey[Unit]("updates .expected for test cases")
Expand All @@ -48,13 +48,40 @@ updateExpected := {
val result = IO.read(resultPath)
val verified = result.strip().equals("Boogie program verifier finished with 0 errors")
if (verified == shouldVerify && outPath.exists()) {
IO.copyFile(outPath, expectedPath)
if (!expectedPath.exists() || !compareFiles(outPath, expectedPath)) {
IO.copyFile(outPath, expectedPath)
}
}
}
}
}
}

def compareFiles(path1: File, path2: File): Boolean = {
val source1 = Source.fromFile(path1)
val source2 = Source.fromFile(path2)
val lines1 = source1.getLines
val lines2 = source2.getLines
while (lines1.hasNext && lines2.hasNext) {
val line1 = lines1.next()
val line2 = lines2.next()
if (line1 != line2) {
source1.close
source2.close
return false
}
}
if (lines1.hasNext || lines2.hasNext) {
source1.close
source2.close
return false
}

source1.close
source2.close
true
}

expectedUpdate(correctPath, true)
expectedUpdate(incorrectPath, false)
}
Expand Down
3,444 changes: 3,444 additions & 0 deletions examples/chase_lev_deque/chase_lev_deque.adt

Large diffs are not rendered by default.

Loading

0 comments on commit ecc244f

Please sign in to comment.